From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10455 invoked from network); 1 Sep 2006 15:27:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-25) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Sep 2006 15:27:40 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 74064 invoked from network); 1 Sep 2006 15:27:32 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Sep 2006 15:27:32 -0000 Received: (qmail 1010 invoked by alias); 1 Sep 2006 15:27:25 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10651 Received: (qmail 1000 invoked from network); 1 Sep 2006 15:27:24 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Sep 2006 15:27:24 -0000 Received: (qmail 73055 invoked from network); 1 Sep 2006 15:27:24 -0000 Received: from nf-out-0910.google.com (64.233.182.190) by a.mx.sunsite.dk with SMTP; 1 Sep 2006 15:27:23 -0000 Received: by nf-out-0910.google.com with SMTP id c31so672627nfb for ; Fri, 01 Sep 2006 08:27:23 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:date:from:to:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=ZFJRCrsHWHq7QSKGN81tp0x5eiT/JAbODfCJNoQDqvRWsRx5da1imqIMM+RPfJ34/bleJ9VpHd6hWYSTlGbs3Gl4p5zcPH1hxl3G10rcttgO1KGxwtkvpiABcRsBgAdQare3VcElHYvLBpidE6UV/cNw1Hv0EEbuLDTg3WR2uwE= Received: by 10.49.8.1 with SMTP id l1mr3110939nfi; Fri, 01 Sep 2006 08:27:22 -0700 (PDT) Received: from crematorium ( [194.44.12.5]) by mx.gmail.com with ESMTP id k9sm3810872nfc.2006.09.01.08.27.20; Fri, 01 Sep 2006 08:27:21 -0700 (PDT) Date: Fri, 1 Sep 2006 18:27:47 +0300 From: Roman Cheplyaka To: zsh-users@sunsite.dk Subject: Re: I want to list the NEXT line after a string appears in a list of files Message-ID: <20060901152747.GB5849@localdomain> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) On Fri, Sep 01, 2006 at 02:59:03PM +0000, zzapper wrote: > Hi > I want to list the NEXT line after a string appears in a list of files > > eg > > egrep "Anecdote" m??.txt (But display next line) > > I guess Sed/Awk would do this, I would probably use Perl. --8<-- #!/usr/bin/perl use strict; my $regex = qr/Anecdote/; my $print = 0; while (<>) { $print && print; $print = /$regex/; } --8<-- But, are you sure you've posted to the right place?.. -- Roman I. Cheplyaka