(sed.info.gz) tac
Info Catalog
(sed.info.gz) Reverse chars of lines
(sed.info.gz) Examples
(sed.info.gz) cat -n
Reverse Lines of Files
======================
This one begins a series of totally useless (yet interesting)
scripts emulating various Unix commands. This, in particular, is a
`tac' workalike.
Note that on implementations other than GNU `sed' this script might
easily overflow internal buffers.
#!/usr/bin/sed -nf
# reverse all lines of input, i.e. first line became last, ...
# from the second line, the buffer (which contains all previous lines)
# is *appended* to current line, so, the order will be reversed
1! G
# on the last line we're done -- print everything
$ p
# store everything on the buffer again
h
Info Catalog
(sed.info.gz) Reverse chars of lines
(sed.info.gz) Examples
(sed.info.gz) cat -n
automatically generated byinfo2html