Finding options for ports

David Landgren david at landgren.net
Thu Nov 25 03:47:15 PST 2004


[cc list trimmed]

Lowell Gilbert wrote:
> Paul Schmehl <pauls at utdallas.edu> writes:
> 
> 
>>--On Monday, November 15, 2004 06:46:42 PM -0600 "Conrad J. Sabatier"
>><conrads at cox.net> wrote:
>>
>>>This is a useless use of "cat".  You could accomplish the same thing
>>>with:
>>>
>>>grep WITH Makefile
>>
>>When there are ten different ways to skin a cat, what makes one way
>>inherently better than another?
> 
> 
> Efficiency.
> Using cat(1) spins off a subprocess.
> 
> http://sial.org/howto/shell/useless-cat/
> 

ooh, just saw this message while catching up on the list.

<rant>

This is a pet peeve of mine. Yeah, sure it spins off another 
sub-process, but who's counting?

A more important issue is that of comfort. Your comfort. If you have a 
number of strings that you want to grep for, it's much more cumbersome 
to work back past the files at the end of the command line to change the 
grep target string.

	grep foo somefile
	grep bar somefile

Assuming bask, you have to step over 'somefile' with some whacky Esc-B 
combo in order to ^W zap the 'foo' field. Contrast this with:

	cat somefile | grep foo
	cat somefile | grep bar

In this second case, you can recall the command and ^W to zap the token 
immediately, and replace it with bar. Much less typing effort. The 
different strings you grep with, the more you save. And then once you've 
grepped what you want, you might then replace the grep by sed, awk, wc 
or whatever. (Yes, I know about ^old^new, but that is even more 
cumbersome that Esc-B).

Let the damned computer burn another process. That's what it's good at!

</rant>

David



More information about the freebsd-questions mailing list