bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep patch


From: Alain Magloire
Subject: Re: grep patch
Date: Thu, 17 Jan 2002 23:03:48 -0500 (EST)

> 
> > Date: Thu, 17 Jan 2002 22:22:08 +0300
> > From: Stepan Koltsov <address@hidden>
> 
> > grep --fake-filename=3D$fn -H pattern
> > is simpler (easier to read) then
> > grep -H pattern | sed 's,(=D3=D4=C1=CE=C4=C1=D2=D4=CE=D9=CA =D7=D7=CF=C4=
> )',$fn,
> 
> But it's not simpler than
> 
> grep -h pattern | sed "s,^,$fn:,"

it can be of some use for things like

# cat /etc/passwd | grep root - *.html
(standard input):operator:x:11:0:operator:/root:
....

# cat /etc/passwd | grep --fake-filename=/etc/passwd root - *.html
/etc/passwd:operator:x:11:0:operator:/root:
...

The problem is for multiple argument files.  In this case the name
of the option should make it clear that it is only for stdin.

> > BTW I don't understand, for what purposes option --recursive presents
> > in grep, it is less handy option, then --fake-filename=3D, because I ca=
> n
> > write
> > find * -type f | xargs grep -H ...
> 
> grep -r is used often enough that it's reasonable to have as an
> option, both for convenience and performance.
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]