# Parsing a multi line txt file

**URL:** <https://tech-community.robotics.abb.com/t/parsing-a-multi-line-txt-file/10270>\
**Category:** RAPID Programming\
**Tags:** readstr\
**Created:** [June 28, 2021, 4:01pm UTC](https://tech-community.robotics.abb.com/t/parsing-a-multi-line-txt-file/10270 "2021-06-28T16:01:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![garlo82](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@garlo82](https://tech-community.robotics.abb.com/u/garlo82)\
**Post date:** [June 28, 2021, 4:01pm UTC](https://tech-community.robotics.abb.com/t/parsing-a-multi-line-txt-file/10270/1 "2021-06-28T16:01:40Z")

</div>

I currently have a system that is reading offsets from a txt file stored in the robot home folder. Basically a csv file copied into a .txt file. The current way of reading it, is using the command below.

stPart:=ReadStr(datafileRd\Delim:=“\09”\RemoveCR\DiscardHeaders);

Each line of txt consists of 60 Tab separated values which the current way of reading means its it reads all 60 values before it reads the next line.

What i am needing to do is after reading the first value on the line, if the value is not equal to the number i am looking for then drop down to the first value of the next line. i would keep dropping down the first value of each line till the value is = to number i am looking for, to which i can then use my existing code to read all the offsets of that line.

What would be the ReadStr command to line feed down as apposed to the above TAB delimeter.

This will reduce processing time of obtaining offsets from some very large txt files

---

<div class="post-metadata">

**Author:** ![lemster68](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/lemster68/32/1945_2.png) [@lemster68](https://tech-community.robotics.abb.com/u/lemster68)\
**Post date:** [June 28, 2021, 4:04pm UTC](https://tech-community.robotics.abb.com/t/parsing-a-multi-line-txt-file/10270/2 "2021-06-28T16:04:30Z")

</div>

I don’t know of any way to “fast forward” the reading of a file, sorry. What if you split each off into its own file?

---

<div class="post-metadata">

**Author:** ![garlo82](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@garlo82](https://tech-community.robotics.abb.com/u/garlo82)\
**Post date:** [June 28, 2021, 4:13pm UTC](https://tech-community.robotics.abb.com/t/parsing-a-multi-line-txt-file/10270/3 "2021-06-28T16:13:03Z")

</div>

We have over 250 lines split over about ten files. This could be an option though. In reality it seems so simple and something easily done in the likes of VBA etc but cant seem to “search down the columns before reading across the line”

---

<div class="post-metadata">

**Author:** ![Micky](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Micky](https://tech-community.robotics.abb.com/u/Micky)\
**Post date:** [July 8, 2021, 11:43am UTC](https://tech-community.robotics.abb.com/t/parsing-a-multi-line-txt-file/10270/4 "2021-07-08T11:43:55Z")

</div>

Hello,  
the function ReadStr provides the parameter “Line” which specifies which line in the file should be read

ReadStr (IODevice [\Delim] [\RemoveCR] [\DiscardHeaders] [\Time] **[\Line]**)

Maybe this parameter can help to solve your problem.
