Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!fmr From: fmr@cwi.nl (Frank Rahmani) Newsgroups: alt.sources Subject: Re: Re: cgname - collect file names from {e,f,}grep output Message-ID: <929@sering.cwi.nl> Date: 25 Jun 89 09:45:55 GMT References: <3687@orca.WV.TEK.COM> Organization: CWI, Amsterdam Lines: 34 > 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@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.