Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Nov 2003 16:45:28 +0100
From:      Ilya Varlashkin <ilya@samara.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: newbie: use <CR> in RE?
Message-ID:  <20031124154528.GA49695@CITADEL.NOBULUS.COM>
In-Reply-To: <017801c3b297$e8404dc0$fa65a8c0@ocfl061>
References:  <3FBF5DEA.2030405@hotmail.com> <017801c3b297$e8404dc0$fa65a8c0@ocfl061>

next in thread | previous in thread | raw e-mail | index | archive | help
> ----- Original Message ----- 
> From: "Zhang Weiwu" <weiwuzhang@hotmail.com>
> To: <freebsd-questions@freebsd.org>
> Sent: Saturday, November 22, 2003 8:00 AM
> Subject: newbie: use <CR> in RE?
> 
> 
> > Hello. Just want to know how to use special character in Regular
> Expression.
> >
> > I wish to remove all the carrier returns from a text file, I can use:
> > tr -d "\r" < text_file > modified_text_file
> > But if I do:
> > sed -i s/\r//g text_file
> > it actually removes all the character "r" from the file.
> >
> > This is also a problem in vi(1). Besides <CR> I wish to manipulate
> > tabstops and line-feeds with RE too.
> >

Depending on file size I use either vi in command mode :g/^M/s///g where
is result of pressing Ctrl-V then Ctrl-M. Or for big files: 

sed 's/^M//' myfile.txt

Hope this helps.

Kind regards,
Ilya Varlashkin

> > _______________________________________________
> > freebsd-questions@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe@freebsd.org"
> >
> 
> 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
> 
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031124154528.GA49695>