read each line in from a file

If you have a new question you’d like our support staff to post a response to, please visit our customer community, GoAnywhere Insiders, to pose the question in our Discussion Boards. We have a thread “Ask Our Tech Experts” that our support team monitors on a regular basis, or you can start a new discussion where other GoAnywhere users and support staff can weigh in. Log in or create your new account at

If you need an immediate response, please create a support ticket or contact our support team by email at [email protected].
2 posts Page 1 of 1


Posts: 1
Joined: Wed Nov 11, 2015 8:15 pm

Post by jmartin » Fri Dec 15, 2017 7:45 pm
read each line in a file

I am trying to read in each line in a generated file but having difficulty.
The file is created in the workspace via the Native Command, its just a 'ls -1' on a directory.

The results look like below in a file called ls1output.txt in the workspace.

I set my rowset variable to: ls1rowSet
and then do a foreach loop to print the lines.

which results in:
12/15/17 4:41:31 PM INFO Executing task 'readFlatFile 1.0'
12/15/17 4:41:31 PM INFO Data parsed successfully and the rowset variable 'ls1rowSet' was created
12/15/17 4:41:31 PM INFO Finished task 'readFlatFile 1.0'
12/15/17 4:41:31 PM INFO Entering loop 'forEachLoop'
12/15/17 4:41:31 PM INFO Opening file '/usr/local/Linoma_Software/GoAnywhere/userdata/workspace/1000000034569/ls1output.txt'
12/15/17 4:41:31 PM INFO Executing task 'print 1.0'
12/15/17 4:41:31 PM INFO [email protected]318ee04d

How can I read these lines in 1 by 1?

Any help is appreciated, tia.

<project name="Seat Vendor Transfers" mainModule="Main" version="2.0" logLevel="debug">
<description>Seat Vendor Testing upload to LAMP</description>

<module name="Main">

<createWorkspace version="1.0" />

<callModule label="Call: Native Cmd" module="Native Cmd" version="1.0" disabled="false" />
<callModule label="Call DirList" module="Create DirList" version="1.0" disabled="true" />
<callModule module="Files" version="1.0" />
<deleteWorkspace version="1.0" disabled="true" />

<module name="Native Cmd" description="runs ls -1 on dir, outputs to file">

<exec executable="ls" executableDir="/usr/bin/" workingDir="/usr/local/Linoma_Software/home/SVT" redirectOutputTo="file" outputFile="./ls1output.txt" outputFileVariable="ls1varout" version="1.0">
<arg value="-1" />
<arg value="/usr/local/Linoma_Software/home/SVT" />


<module name="Files">

<readFlatFile inputFile="./ls1output.txt" outputRowSetVariable="ls1rowSet" version="1.0" />

<forEachLoop itemsVariable="${ls1rowSet}" currentItemVariable="currItem">

<print version="1.0">


<module name="Create DirList">

<createFileList fileListVariable="dirList" version="1.0">
<fileset dir="${ls1varout}" />




User avatar
Posts: 12
Joined: Thu Feb 16, 2017 11:20 am

Post by Support_Josh » Wed Jan 03, 2018 12:03 pm
The issue that you are running into is a difference between what GoAnywhere MFT is expecting as a Record Delimiter and what the file actually is. If the file was created on a Linux OS, the EOL characters only consist of LF characters but MFT is set to look for CRLF to separate each record. Since the file doesn’t have those line endings, GoAnywhere MFT will read in the entire file as a single line.

To change that behavior, navigate to the Read Flat File task and open up the Advanced tab. Once opened up, you need to switch your Record Delimiter from CRLF to just LF. See screenshot below:
After making that change, your records should parse out separately and then should be able to create file lists as expected!
Joshua Przybysz
Senior Support Analyst
e. [email protected]
p. 1.800.949.4696
2 posts Page 1 of 1