Mac OS X,  Mac OS X Server,  Mac Security,  Mass Deployment,  Network Infrastructure,  Programming,  Ubuntu,  Unix

Opposite Day: Reversing Lines In Files

The other day, my daughter said “it’s opposite day” when it was time to do a little homework, trying to get out of it! Which reminded me of a funny little command line tool called rev. Rev reads a file and reverses all the lines. So let’s touch a file called rev ~/Desktop/revtest and then populate it with the following lines:

123
321
123

Now run rev followed by the file name:

rev ~/Desktop/revtest

Now cat it:

cat !$

Now rev it again:

rev !$

You go go forward and back at will for fun, much more fun than homework… Enjoy!