[olug] Unix Tip: OUTPUT A FILE IN REVERSE

Kenton Brede xyf at nixnotes.org
Mon Apr 28 16:58:48 UTC 2003


On Mon, Apr 28, 2003 at 08:59:06AM -0500, William E. Kempf wrote:
> 
> Kenton Brede said:
> > On Tue, Apr 22, 2003 at 09:48:17AM -0500, William E. Kempf wrote:
> >>
> >> Thom Harrison said:
> >
> > <snip>
> >> 3) Why in the world is this a seperate program?  (If there is a need
> >> for this sort of thing, shouldn't it be a command line switch on cat?)
> > <snip>
> >
> > There is a short book that may help answer this question for you.  It is
> > called, "The Unix Philosophy" by Mike Gancarz.  The answer would fall
> > under number one and two of the "nine major tenets":
> >
> > 1. small is beautiful
> > 2. make each program do one thing well
> 
> Uhmm... bull hockey.  The added overhead involved by making this a
> seperate program can not justify this choice.
> 
> 1. cat --reverse would still be small (and would be significantly smaller
> than the combination of cat and tac).
> 2. I'd argue that printing in reverse is not additional functionality,
> only a variation on what cat already does.  If I applied your logic to
> reversing, I'd have to apply it to numbering lines as well, and so the
> design would still be screwed, just in a different way.
> 
> I understand the "Unix Philosophy", and have heard it touted before, but I
> don't think it was properly applied in this case.

I could care less either way but not by much.  Cat and tac can certainly
be construed to fall under those tenants.  Don't like the existence of
tac, grab the source for cat and add the switch you want.  Hmmm... or 
would you grab the source for tac? ;)  
cat foo | tac
kent

-- 
"I am always doing that which I can not do, 
   in order that I may learn how to do it." --Pablo Picasso


More information about the OLUG mailing list