Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jan 2004 15:14:50 +1030
From:      "Rob" <listone@deathbeforedecaf.net>
To:        "David Fleck" <david.fleck@mchsi.com>, "Gary Kline" <kline@thought.org>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: stumped... .
Message-ID:  <007d01c3dd7d$d0917530$a4b826cb@goo>
References:  <20040118030911.GA18161@tao.thought.org> <20040117215110.R602@grond.sourballs.org>

next in thread | previous in thread | raw e-mail | index | archive | help
David Fleck wrote on Sunday January 18, 2004:


> On Sat, 17 Jan 2004, Gary Kline wrote:
> 
> >
> > I've written scores of scripts to hack text files, but this
> > one has me dead in the water.
> >
> > How can I delete all lines from /^PATTERN to EOF??
> >
> > ed - <<foo
> >
> > /^PATTERN
> > (.,$)d
> > w
> > q
> > foo
> >
> > or anything else I've tried doesn't do it.  I could do it in
> > C/C++,but c'mon... !  Any solutions in sed, perl, or ed/ex?
> 
> Well, you didn't mention awk, but...
> 
> 
> awk '$0 ~ /^PATTERN/ {x=1}; {if (x!=1) print $0}' < foo > bar
> 

Wouldn't it be neater to do 

  nawk '/^PATTERN/ { exit } ; { print }'

?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?007d01c3dd7d$d0917530$a4b826cb>