Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: I want to list the NEXT line after a string appears in a list of files
- X-seq: zsh-users 10651
- From: Roman Cheplyaka <roman.cheplyaka@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: I want to list the NEXT line after a string appears in a list of files
- Date: Fri, 1 Sep 2006 18:27:47 +0300
- 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=
- In-reply-to: <Xns9831A29573C98zzappergmailcom@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <Xns9831A29573C98zzappergmailcom@xxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author