From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24172 invoked from network); 2 Sep 2006 14:00:28 -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.2 required=5.0 tests=AWL,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; 2 Sep 2006 14:00:28 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 27133 invoked from network); 2 Sep 2006 14:00:16 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Sep 2006 14:00:16 -0000 Received: (qmail 18916 invoked by alias); 2 Sep 2006 13:59:58 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10657 Received: (qmail 18906 invoked from network); 2 Sep 2006 13:59:57 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 2 Sep 2006 13:59:57 -0000 Received: (qmail 24823 invoked from network); 2 Sep 2006 13:59:57 -0000 Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by a.mx.sunsite.dk with SMTP; 2 Sep 2006 13:59:55 -0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GJW2C-0005ke-Bu for zsh-users@sunsite.dk; Sat, 02 Sep 2006 15:59:44 +0200 Received: from 241.119-84-212.staticip.namesco.net ([212.84.119.241]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 02 Sep 2006 15:59:44 +0200 Received: from david by 241.119-84-212.staticip.namesco.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 02 Sep 2006 15:59:44 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@sunsite.dk From: zzapper Subject: Re: I want to list the NEXT line after a string appears in a list of files Date: Sat, 2 Sep 2006 13:59:38 +0000 (UTC) Organization: SuccessTheory Message-ID: References: <20060901151507.GA32421@mollari.zhar.net> X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 241.119-84-212.staticip.namesco.net User-Agent: Xnews/5.04.25 Sender: news John Eikenberry wrote in news:20060901151507.GA32421 @mollari.zhar.net: > 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. >> >> Suggestions pls >> > > Note zsh specific, but this should work. > egrep -A1 "Anecdote" m??.txt | tail -1 John That's useful I thought I knew everything about grep but no! BTW works without the tail egrep -iA2 "^Anecdote" m??.txt -- http://successtheory.com/tips/ Vim, Zsh, MySQL Tips