[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep patch
Re: grep patch
Fri, 18 Jan 2002 09:24:10 -0500 (EST)
> > Date: Thu, 17 Jan 2002 23:03:48 -0500 (EST)
> > From: "Alain Magloire" <address@hidden>
> > 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:
> That's not a persuasive example, as
> # grep root /etc/passwd *.html
> does what you want and is obviously cleaner than the --fake-filename
> approach. I guess I'd have to see a real example to see what people
> are driving at.
Replace "cat /etc/passwd" with a program:
# ./some_program_reading_a_DB | grep --fake-filename=DBM.dbm root - *.html
Many times, grep is use under the cover for shell scripts and it can
be handy. For example some scripts will do some preprocessing
on the file because it is encoded :
# gzip -dc file.gz | grep --override-stdin-name=file joe
> > 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.
> Hmm, that wasn't clear to me, and still isn't. Sorry, I guess I'm not
> getting the motivation.
> How about if we change grep to output "-:" instead of "(standard
> input):"? That might address some of the issue here. It would be
> less ambiguous, and it would easier to program with in i18n
But I think, it would be nice to let the
user override the hardcoded "(standard input)" default name.
I've never like hardcoded things that you could not override.
Re: grep patch, Bernhard Rosenkraenzer, 2002/01/18
Re: grep patch, Paul Eggert, 2002/01/18