Date: Thu, 16 Oct 2003 23:45:44 +0300 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Gary Kline <kline@thought.org> Cc: freebsd-questions@freebsd.org Subject: Re: utility idea Message-ID: <20031016204544.GA2068@gothmog.gr> In-Reply-To: <20031016171856.GA51167@tao.thought.org> References: <20031016171856.GA51167@tao.thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031016204544.GA2068>