Bash – Parse a file forwards and backwards

By | April 15, 2015

Some people say that you never know everything, how very true that is when you are scripting in Bash Shell. A week ago I found out something I needed to do a million times before, but had always re-invented the wheel to do so….

Bash – Parse a file FORWARDS (the easy one)

cat <file> | while read LINE ; do

echo $LINE

done

so now…

Bash – Parse a file BACKWARDS (cat backwards = tac)

tac <file> | while read LINE ; do

echo $LINE

done

Wasnt hard was it, but like any question, its only easy if you know the answer !! I have made a new post for this with a more practical example/tutorial HERE

Check out -  Linux - Find empty directories and/or remove

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.