Wednesday, July 13, 2011

Two noteworthy commands in Linux to "reverse" the lines

I always appreciate the small and powerful command-line tools which are designed for Linux. Today, I was looking for a command to reverse the order of lines in a line. First, I came a cross rev. This command only reverses the order of characters in each line of the given stream.

After that, I found tac command. This command did the job very well as I expected. It is also able to concatenate several files and accepts regex sperators.