HOWTO: Use the TAC Command.
I’m sure you’re all just absolutely thrilled that I’m studying for my LPIC. Otherwise, you wouldn’t have all thes neato posts about obscure Linux commands that you’ll likely never use.
Ah well. Let me get over this first chapter and then we’ll get into the more interesting stuff:)
Today’s command is tac. The tac command is named purposely as a reverse of the cat command because, well, it prints out files in reverse. If I have a file named animals that looks like:
The dog
The cat
The bird
and I run the command tac animals, I get:
The bird
The cat
The dog
There are a few switches you can tack (get it?!) onto the end to modify the default behaviour.
Useful? Now and again, I suppose.
Related Stories
POSTED IN: General
1 opinion for HOWTO: Use the TAC Command.
jadu saikia
Nov 2, 2008 at 9:14 am
tac is useful for reversing order of all lines of a file. I feel tac needs to provide ways to reverse order of few lines(not all lines); e.g.
$ cat details.txt
line1
line2
line3
line4
line5
line6
line7
line8
line9
line10
reverse order of lines from 5 to 8
line1
line2
line3
line4
line8
line7
line6
line5
line9
line10
We can achieve this using awk; but a support from tac would have been more handy.
// unstableme.blogspot.com
Have an opinion? Leave a comment: