Invoke method to remove lines from a text file

Hi Guys,

I need to removes few lines from a text file using only assign and invoke methods.

  1. I used a Assign activity (in a variable of type list of strings): File.ReadAllLines(“Filepath”).ToList
  2. Use invoke method to delete first 31 lines from the text file.

I tried using remove method but it displays error that list does not have public instance name ‘remove’.
Please suggest if anything needs to be configured in properties (parameters and arguments)
Please suggest an approach to implement this.

Dim delLine As Integer = 32
Dim lines As List(Of String) = System.IO.File.ReadAllLines("infile.txt").ToList
lines.RemoveAt(delLine - 1) ' index starts at 0 
System.IO.File.WriteAllLines("outfile.txt", lines)

Try this @poojakumari

That worked for me , Thank you so much.

Now I want to delete fast 3 lines from my text file. How can I implement using assign or invoke method activities.

HI Pooja, how did you remove first three lines in a .txt file

Using invoke method, use invoke range and provide a range of lines to delete in collection property.

Hi @poojakumari Can you share an example of how you did this?

Hi @sreekanth @aksh1yadav

Can you please help me on,how to remove the line items from text file based on few values(The values are in excel file).

Regards,
Rajesh