reversing lines in a file

preece at ccvaxa.UUCP preece at ccvaxa.UUCP
Tue Oct 1 04:20:00 AEST 1985


> [suggests line-by-line reversal of file by sed|num|sort|sed]
> Short, simple, and adequate, besides that fact that it took a grand
> total of 20 seconds to figure out, and maybe 30 to type.  Not bad for a
> 1 minute solution /* Written  3:34 pm  Sep 27, 1985 by
> gregg at okstate.UUCP in ccvaxa:net.sources */
----------
Yes and no.  At least some of the files I have wanted to look at
backwards had millions of lines (that's millions literally, not
hyperbole).  This kind of solution is not terribly useful or
adequate for that use.  It's important to remember that a tool's
availability is only one factor in determining its applicability.
Don't swat flies with an elephant gun and don't drain swimming pools
with a teaspoon unless (1) it's really important that the job get
done and (2) it's really the only tool available.  It's wonderful
that Unix has all these general purpose, composable tools; just
don't forget that sometimes it's APPROPRIATE to build others.

-- 
scott preece
gould/csd - urbana
ihnp4!uiucdcs!ccvaxa!preece



More information about the Comp.sources.unix mailing list