Date: Sat, 17 Jan 2004 22:37:00 -0500 From: "Matt Emmerton" <matt@gsicomp.on.ca> To: "Gary Kline" <kline@thought.org>, "FreeBSD Mailing List" <freebsd-questions@freebsd.org> Subject: Re: stumped... . Message-ID: <002601c3dd74$55f46250$1200a8c0@gsicomp.on.ca> References: <20040118030911.GA18161@tao.thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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? > > tia, everybody, > > gary If I'm understanding your question correctly, this Perl script should do it. #!/bin/perl while (<>) { if (/^PATTERN) { last; } print $_; } -- Matt Emmerton
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002601c3dd74$55f46250$1200a8c0>