On Wed, 2007-10-03 at 19:22 +1000, Peter Hardy wrote:
> On Wed, 2007-10-03 at 18:52 +1000, david wrote:
> > [EMAIL PROTECTED]:~/test/testdir $ cat > test
> > 1
> > 2
> > 3
> > [EMAIL PROTECTED]:~/test/testdir $ sed s/1\n/1/g test
> > 1
> > 2
> > 3
> > [EMAIL PROTECTED]:~/test/testdir $
> >
> > The output I would have liked would be:
> >
> > 12
> > 3
> >
> > but sed doesn't seem to work like that. Pity. I'm pretty sure you can't
> > get vim to do it either. I'm assuming vim just uses sed anyway?
>
> vim will do that just fine, and is pretty much my go-to when I find
> myself needing to do it.
>
> I did find a way to search/replace across newlines with sed, too, but it
> made my head hurt.
thanks everyone.
Looks like it's time to stop avoiding perl. (thanks Gavin).
perl -i -pe 's/1\n/1/' test
vim does work, and I just realised that it can be scripted - I should
have checked instead of ass-uming. The things you can learn by asking.
sed pattern buffering started to make my head hurt too :-) or maybe it's
just too late at night after a hot day.
http://snow.nl/dist/htmlc/ch13s04.html
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html