grep replacement (filenames, maybe)

Mike Wolfe wolfe at pdnbah.uucp
Fri Jun 17 23:44:13 AEST 1988


In article <540 at sering.cwi.nl> fmr at cwi.nl (Frank Rahmani) writes:
>> Xref: mcvax comp.unix.wizards:8598 comp.unix.questions:6792
>> Posted: Fri Jun 10 05:29:43 1988
>> 
>> In article <8012 at brl-smoke.ARPA>, gwyn at brl-smoke.ARPA (Doug Gwyn ) writes:
>> A real useful `tool', this, that works only on files.  And only when
>> you grep more than one file, so you get filenames (or happen to be able
>> to remember which flag it is to make grep print filenames always,
>> assuming of course that your grep has it).
>...
>...
>that's the smallest of all problems, just include /dev/null as first
>file to be searched
>into your script like
>grep [options] pattern /dev/null one_or_more_filenames

Smallest of all problems? One of my pet peeves is the fact that certain
commands will only print filenames if you give it more than one file. While
the /dev/null ugliness is a suitable kludge for the grep case what about
a case were you want to run something using xargs, something like sum. You
don't want /dev/null repeated for each call. I know I can sed it out but
that's just a kludge for a kludge and to me that's a red flag.

I think that all commands of that type should allow you to force the filenames
in output. I don't want to go back and change all the commands (UNIX++ a
modest proposal ;-). I just wish people would keep this in mind when writing
things in the future.

----
Mike Wolfe
Paradyne Corporation,  Mail stop LF-207   DOMAIN   wolfe at pdn.UUCP
PO Box 2826, 8550 Ulmerton Road           UUCP     ...!uunet!pdn!wolfe
Largo, FL  34649-2826                     PHONE    (813) 530-8361



More information about the Comp.unix.wizards mailing list