Unix or Linux tac command is the reverse of the cat command. It is also known as cat backward. It prints the last line first, then second last and so on.
Sample syntax of tac command :
# tac <file name>
Like example of tac command :
# tac test2
We have displayed the file ‘test2’ with both the commands ‘cat’ and ‘tac’ to show the difference between the two.
To Separate The Content command
The command tac –separator will separate the content from the mentioned string or keyword from the rest of the file content.
Sample syntax of tac –separator command :
# tac <file name> –separator “<string>”
Like example of tac –separator command :
tac count –separator “solution”
tac count –separator ” ” <you can add another one>
tac count –separator ” ” <you can add another one >