cgname - collect file names from {e,f,}grep output

Frank Rahmani fmr at cwi.nl
Sun Jun 25 19:45:55 AEST 1989


> easier to maintain and manage.  (Smaller on disk too :-)
> fgrep BLAH *.[ch] | cut -d: -f1 | sort | uniq > /tmp/123 ; vi /tmp/123
> This is not a flame.	This is not a flame.	This is not a flame.
But this one is!!
Your 'tool' doesn't do anything else than open vi on a list of files
that contain BLAH. Very useless indeed.
What you probably mean is:
#!/bin/sh
fgrep $1 *.[ch] | cut -d: -f1 | sort | uniq > /tmp/123 ; e +/$1 `cat /tmp/123`
which opens one or more files on the line that contains the expression
you are looking for. Pay attention that I'm using 'e' instead of 'vi'.
'E' is an interface for vi (was posted on comp.sources.unix) that
maintains durable history files in the directory where 'e' was started.
So you get a log of what you edited and you can access files exactly
by the same syntax as you are accessing commands from the csh .history
file (which is especially handy when you want to edit multiple files.
An example of '.e':
+/define cgname.c dnetmail.c getoptx.c gnu2coff0.6.apollo.c newconv.c scsidriver.seagate.c shadow.c sixel.c tarmail.c text2ps.c timerdriver.c
+/grep cgname.c
../bin/grepvi

While I'm busy: one more flame!
People are posting their tools to help others. When you are convinced
that _YOUR_ tools are better, test them before posting. I'm grateful
for everything that is poted and _WORKS_, it doesn't have to be the
most clever thing on earth. Sometimes its very handy to have different
tools doing the same thing.
Cheers
fmr at cwi.nl
-- 
It is better never to have been born. But who among us has such luck?
Maintainer's Motto:
	If we can't fix it, it ain't broke.
These opinions are solely mine and in no way reflect those of my employer.  



More information about the Alt.sources mailing list