Sometimes it's useful to cat a file in reverse order. An example would be doing things like parsing log files and such. I had a need to do this today and stumbled onto the cleverly named tac program. Usage is simple:
tac somefile.txt > somefile_reversed.txt
Showing posts with label reverse. Show all posts
Showing posts with label reverse. Show all posts
Tuesday, August 19, 2008
Thursday, May 8, 2008
Reverse Lines in a File
You can quickly reverse all lines in a file using the following ex command.
:g/^/m0
This is particularly useful for files that are in chronological order such as logs or email mbox files. Thanks to Skyler for submitting the tip.
:g/^/m0
This is particularly useful for files that are in chronological order such as logs or email mbox files. Thanks to Skyler for submitting the tip.
Subscribe to:
Posts (Atom)