Concatenate and write files in reverse, copies each FILE ( - means standard input), or standard input if none are given, to standard output, reversing the records (lines by default) in each file separately.

      tac [options]... [file]...


        The separator is attached to the beginning of the record that it
        precedes in the file.

        Treat the separator string as a regular expression.  Users of 'tac'
        on MS-DOS/MS-Windows should note that, since 'tac' reads files in
        binary mode, each line of a text file might end with a CR/LF pair
        instead of the Unix-style LF.

        Use SEPARATOR as the record separator, instead of newline.

Each Record is separated by an instance of a string (newline by default). By default, this separator string is attached to the end of the record that it follows in the file.

tac is cat backwards.


Even in the summer
even in the spring
You can never get too much of a wonderful thing

$ tac pj.txt

You can never get too much of a wonderful thing
even in the spring
Even in the summer

“The best is the enemy of the good” - Voltaire

Related linux commands

cat - Display the contents of a file.
comm - Compare two sorted files line by line.
csplit - Split a file into context-determined pieces.
paste - Merge lines of files.
sort - Sort text files.
- Split a file into fixed-size pieces.

Copyright © 1999-2023 SS64.com
Some rights reserved