Date: Thu, 16 Oct 2003 14:49:03 -0700 From: Gary Kline <kline@thought.org> To: Giorgos Keramidas <keramida@ceid.upatras.gr> Cc: freebsd-questions@freebsd.org Subject: Re: utility idea Message-ID: <20031016214903.GA51664@tao.thought.org> In-Reply-To: <20031016204544.GA2068@gothmog.gr> References: <20031016171856.GA51167@tao.thought.org> <20031016204544.GA2068@gothmog.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Oct 16, 2003 at 11:45:44PM +0300, Giorgos Keramidas wrote: > On 2003-10-16 10:18, Gary Kline <kline@thought.org> wrote: > > Is there an existant utility (script) that captures the output of > > grep -n and, using vi then presents the user with the list of files > > that are brought at the first point where the string was seen. > > E.g, if I'm recursively searching for the string "ncount" and find > > several files, the script would queue up each file. > > > > (I seem to remember a debugging script that would do something like > > this using the err output from cc, but this was years and years ago.) > > > > Clues welcome, people, > > You can probably hack something around grep/awk, i.e.: > > : g:/etc/mail> grep -n 'otenet' * > : gothmog.cf:154:DSmail.otenet.gr > : gothmog.mc:8:define(`SMART_HOST', `mail.otenet.gr') > : sendmail.cf:154:DSmail.otenet.gr > : > : g:/etc/mail> grep -n 'otenet' * | awk -F: '{print "vi +"$2,$1}' > : vi +154 gothmog.cf > : vi +8 gothmog.mc > : vi +154 sendmail.cf > > Filter the output of that last pipeline through sh(1) and vi will fire > up as many times as necessary: > > : g:/etc/mail> grep -n 'otenet' * | awk -F: '{print "vi +"$2,$1}' | sh > > HTH, Giorgos > Howdy! Yes, this helps. I remember hacking something vaguely along this line in C (when my knoweldge of perl was virtually nil). Can't find the program! thanks for the ideas, gary -- Gary Kline kline@thought.org www.thought.org Public service Unix
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031016214903.GA51664>