Quantcast
Channel: krypted – krypted
Viewing all articles
Browse latest Browse all 1241

Opposite Day: Reversing Lines In Files

$
0
0

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!


Viewing all articles
Browse latest Browse all 1241

Trending Articles