This is how you iterate thru a text file outputting a line at a time in Bash shell scripting.
IFS=$'\n'; for i in $(cat FILE.TXT); do echo "$i"; done
This entry was posted
on Friday, May 25th, 2012 at 4:31 am and is filed under Code, Command Line, Linux.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Actually, this is how not to do it — it starts a useless cat process and needs to store the whole file in memory. The right way to do it goes like this:
while read line
done < FILE.TXT
Mail (will not be published) (required)
Notify me of followup comments via e-mail
I am Binny V A, a freelance Web Developer on the LAMP Platform. Open Source Geek.
Follow me(@binnyva) on Twitter