From owner-freebsd-questions@FreeBSD.ORG Thu Oct 16 14:10:41 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1F2CD16A4B3 for ; Thu, 16 Oct 2003 14:10:41 -0700 (PDT) Received: from terpsi.otenet.gr (terpsi.otenet.gr [195.170.0.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id 56F4F43FBD for ; Thu, 16 Oct 2003 14:10:39 -0700 (PDT) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-a052.otenet.gr [212.205.215.52]) by terpsi.otenet.gr (8.12.10/8.12.10) with ESMTP id h9GL9UQX022768; Fri, 17 Oct 2003 00:10:26 +0300 (EEST) Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.10/8.12.10) with ESMTP id h9GKjiuM002240; Thu, 16 Oct 2003 23:45:45 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.12.10/8.12.10/Submit) id h9GKjigQ002239; Thu, 16 Oct 2003 23:45:44 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Thu, 16 Oct 2003 23:45:44 +0300 From: Giorgos Keramidas To: Gary Kline Message-ID: <20031016204544.GA2068@gothmog.gr> References: <20031016171856.GA51167@tao.thought.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031016171856.GA51167@tao.thought.org> cc: freebsd-questions@freebsd.org Subject: Re: utility idea X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2003 21:10:41 -0000 On 2003-10-16 10:18, Gary Kline 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