Counting characters with unix utilities

Randal Schwartz merlyn at iwarp.intel.com
Tue Sep 25 10:05:16 AEST 1990


In article <MWM.90Sep24143855 at raven.pa.dec.com>, mwm at raven (Mike (My Watch Has Windows) Meyer) writes:
| Why? Some people prefer the form
| 
| 	cat file | utility args
| 
| to
| 
| 	utility args < file
| 
| Why change from one to the other, except for efficiency? And even
| then, there isn't enough difference to bother with for a command line.
| For a script, you'd want to use the latter, though. But then the
| difference is hidden from the user.

Efficiency.  Yow.  Try using a slow machine sometime, where five people
have bogged it down with extra "cat" processes.  Besides, if you want
similar forms, use

	<file utility args

which changes to

	<file util2 args | utility args

and

	<file util3 args | util2 args | utility args

see... pretty orthogonal.  (What?  You didn't know that you could
stick redirects over there?  Shame on you! :-)

I sometimes do

	<fromfile cmd arg arg arg >tofile

so that when I edit the command line, it stays clean.

Just another shell hacker,
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/



More information about the Comp.unix.questions mailing list