I want to read a file as long as I read a certain line text

welcome
IAM New
I need to understand reading this file is easy, but I also want to read a specific line for example
What I want is how to request a line from these lines, knowing that what is inside it is variable, that is, it is not fixed. I want to call number 2 for example and put it in Verabil

1 helow uipath
2your name
3age

Found this but I can’t recall a specific column

you can do:

  • read text activity strText
  • then split the text: arrLines = strText.Split({Environment.NewLine}, StringSplitOptions.None)
  • accessing the second line by arrLines(1)

Or

With variation
strLine = File.ReadLines(FileName).Skip(1).Take(1).First()

Or

  • using reader = new StreamReader(“SourceSettings.txt”))
  • skip the result of first reader.ReadLine(); // skip
  • read second line: secondLine = reader.ReadLine();
  • close the reader
1 Like

Is it possible for you to clarify, I put the code on more than one site, but it did not work?

Also share with us, what is not working e.g. validation message and what you have done so far. thanks

wher i put this code split the text: arrLines = strText.Split({Environment.NewLine}, StringSplitOptions.None)

@feras_assaf
An implementation could look like this:
grafik
grafik

OR when we want to do with the other option:
grafik
grafik

1 Like