Read a specific line in text file

Hello,
I’m very new to UiPath, have done some automatizations with the help of ytb videos and this forum but now I really can’t find the right solution for the following problem:
I a bunch of text files with the same structure and I need to read specific lines for different tasks.
Ex:

KELLOGS GEORGE
TR=TURKEY
PP
TR 931233
X
_
200.00
TRY
1
0,2200
0,000
0
970.00
C
006=02

I need to extract the first line and do something with it, then, separately, the 3rd and 4th line and do something else with them, etc
All the files have the same structure, first line is the name, second is the country, third is id type, etc. How can I extract the x-th line from these files?

Thank you in advance for your kind answers/suggestions! :heart:

PS: Searching the forum I have seen the How to read specific line in a notepad++ thread, and part of the solution would be perfect for me but opening the example UiPath warns me that the project uses “Windows legacy compatibility which is being phased out” and that worries me because this is just part of a bigger project and maybe I won’t be able to design the rest properly (find the right examples and tutorials for the other parts of the project)

PPS: “The names have been changed to protect the innocent” :smiley:

Hi @Paul-Constantin_Cicirone

You can use regex to extract specific lines from the above text, for example strvar variable holds the text you need to extract but that must be a string variable.
Step 1: Create an Array of string (Arrayvar)
Step 2 : Put this expression inside assign activity Arrayvar = System.text.RegularExpressions.Regex.Matches(strvar,“/n”)

Now all the lines are extracted separately and stored inside the array variable Arrayvar. Starting index of array is always 0

So if you need to get first line alone you can simply put like this ex : Arrayvar(0) and for third line Arrayvar(2).

Hope the above solution solves your issue

Regards,
Robin