Tuesday, August 19, 2008

Reverse A File

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

2 comments:

Anonymous said...

I had to do some work to some directories recursively, where I had to make modifications in order from the deepest directories to the the closest directories to the root of the call. 'find ... -type d | tac' came in handy for that. An nice command indeed.

Anonymous said...

great, that is a nice tip!