reading from file bottom up

Matt Graham danceswithcrows at usa.net
Fri Dec 28 11:29:41 MST 2007


From: "Jeremy C. Reed" <reed at reedmedia.net>
> On Fri, 28 Dec 2007, Nathan Aubrey wrote:
> > tac .  I love the ingenious designs of *nix.
> Not all *nix.
> tac(1) is from coreutils commonly used on Linux systems.
> Many *nix systems don't have "tac".
> I use "tail -r" on some systems. And use sed on other systems.

perl -e 'print reverse <>' < file

...many things have Perl installed now, after all.  NOTE:  Doing
this on a file over about 20 M may cause thrashing if you don't
have a lot of RAM.

> Do a google search and you will find many ways to reverse a file.

Aye.  Also multiple definitions of "reverse"; do you want to reverse
bytes, or reverse lines?  Usually it's the latter, but there are
always exceptions.




More information about the PLUG-discuss mailing list