[Gllug] simple sed question

robin.c.smith at bt.com robin.c.smith at bt.com
Mon Oct 15 13:22:54 UTC 2001


To answer my own question ( after reading a bad man page - always RTFM ),
the following sed works on my Sun 5.6 box, ^M is ctrl-M:-

Put this in a file e.g. a.sed

/^M$/{
  N
  s/^M\n//g
} 

and then run 

sed -f a.sed filetomodify 

Robin

-----Original Message-----
From: Bruce Richardson [mailto:itsbruce at uklinux.net]
Sent: 15 October 2001 14:06
To: gllug at linux.co.uk
Subject: Re: [Gllug] simple sed question 


On 10/15/01, 12:09:10 PM, tet at accucard.com wrote regarding Re: [Gllug] 
simple sed question :


> >not too sure about the sed, but watch out with the ^M, to reproduce it 
(in
> >vi at least) you need to use:
> >
> >Ctrl-V
> >Ctrl-M

> Also note that despite its name, sed is line based, rather than truly
> stream based, so you can't match patterns across lines, and hence its
> probably not the right tool to use here.

GNU sed supports a newline in the regexp, as do some other 
implementations, and has no maximum line length so you can match across 
as many lines as you care to.

-- 

Bruce

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list