Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!zephyr!tektronix!orca!quark!jeff From: jeff@quark.WV.TEK.COM (Jeff Beadles) Newsgroups: alt.sources Subject: Re: cgname - collect file names from {e,f,}grep output Keywords: egrep fgrep grep Message-ID: <3687@orca.WV.TEK.COM> Date: 25 Jun 89 00:20:41 GMT References: <130@tridom.uucp> Sender: nobody@orca.WV.TEK.COM Reply-To: jeff@quark.WV.TEK.COM (Jeff Beadles) Organization: Tektronix, Inc., Wilsonville, OR Lines: 29 In article <130@tridom.uucp> wht@tridom.uucp (Warren Tucker) writes: |This quickie collects the filenames produced by grep output |while passing the output oin to stdout. I wrote it to help |me build a list of filenames to edit containing a certain string: | |usage: {e,f,}grep | cgname [| ...]\n"); |collects list of files reported by grep into \n"); |cgname reads grep output, passing it on to cgname's stdout\n"); |and produces a sorted list of filenames into \n"); | |i.e.: | | fgrep BLAH *.[ch] | cgname /tmp/123 | vi `cat /tmp/123` | |{awk,sed,perl}-fanatic flames > /dev/null Well, with a line like above... I'm a 'cut' fan. Try this: It's a LOT 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. This is not a flame. This is not a flame. This is not a flame. -Jeff -- Jeff Beadles Utek Sustaining Engineering, Tektronix Inc. jeff@quark.WV.TEK.COM (or) uunet!tektronix.tek.com!quark.wv!jeff