Re: sed awk question

From: David J. Weller-Fahy <dave-lists-aklug@weller-fahy.com>
Date: Sun Jun 13 2004 - 22:58:18 AKDT

* David J. Weller-Fahy <dave-lists-aklug@weller-fahy.com> [2004-06-12 01:24 -0800]:
> > > > let's say I have a file.
> > > > BOFa\nb'pattern'd\ne'pattern'y\nzEOF
> > > >
> > > > I want to spilt this file at 'pattern', using something like :
> > > > cat filename | sed s/'pattern'/EOF/
> > > > [snip]
> > > >
> > > > suggestions?
>
> Hrm. I believe it'd be doable with sed, and something like the
> following may work.
>
> sed 's/\(.*\)pattern\(.*\)pattern\(.*\)/\1\2\3/' inputfile
>
> However, it is late. I'll think more on it tomorrow.

It occurs to me that what you want is not to split the pattern, but to
remove it. If that's the case, the following sed command should work:

sed 's/pattern//g'

Regards,

-- 
dave [ please don't CC me ]
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sun Jun 13 22:54:45 2004

This archive was generated by hypermail 2.1.8 : Sun Jun 13 2004 - 22:54:46 AKDT