[Gllug] simple sed question

Murray Walker MurrayW at fool.co.uk
Mon Oct 15 10:44:04 UTC 2001


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

If you copy and paste any text/code, the original will be replaced by (the 2
character string) "^M" rather than the (single) control character.
Apologies if that is blindingly obvious, but I've spent longer than I should
finding that buggette in code before. I'm a bit of a dullard like that ;-)

Ctrl-M on it's own gets you a new line.

Murray.

> -----Original Message-----
> From: Simon Stewart [mailto:sms at lateral.net]
> Sent: Monday, October 15, 2001 11:37 AM
> To: gllug at linux.co.uk
> Subject: Re: [Gllug] simple sed question
> 
> 
> On Mon, Oct 15, 2001 at 11:07:30AM +0100, robin.c.smith at bt.com wrote:
> > We have a program that generates a log file and sometimes 
> this log file gets
> > a bit corrupted and splits the line up with
> > ^M (control-M) at the end. How do I get rid of the ^M and 
> join the lines in
> > sed?
> 
> The "control-M" is probably a carriage return. You could do something
> like:
> 
> tr -d '\r' <logfile >outfile  # Deletes all the carriage returns
> 
> or 
> 
> tr '\r' ' ' <logfile >outfile # Translates the \r to a space.
> 
> Cheers,
> 
> Simon
> 
> -- 
> "I lost a button hole today." --- Steven Wright
> 
> -- 
> 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