Reversing a file?

Jon LaBadie jon at jonlab.UUCP
Sun Oct 8 16:40:50 AEST 1989


A posting asked about how to reverse the sequence of the lines of a
file.  Generally, my news feed is delayed by 3 - 5 days so I do not
post responses to the net, but mail to the poster directly.  I assume
the answer will be provided by someone else before my posting would
ever make it to the net.

However, in this case, no one seems to have posted the (IMHO) elegant
solution I would propose.  Thus, my suggestion for:

	HOW DO YOU REVERSE THE LINES OF A FILE?

ed - ${1} <<!
    g/^/m0
    w
    q
!

Any questions?

-- 
Jon LaBadie
{att, princeton, bcr}!jonlab!jon
{att, attmail, bcr}!auxnj!jon



More information about the Comp.unix.questions mailing list