newbie: use <CR> in RE?
Jerry McAllister
jerrymc at clunix.cl.msu.edu
Sat Nov 22 06:49:31 PST 2003
>
> 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.
So why not just use tr? \t should get tabs, as you noted \r gets CRs
I don't know linefeed off hand, but wouldn't be surprised if it was \l.
It follows the usual conventions.
There are more things besides -d that you can do with tr also.
////jerry
>
More information about the freebsd-questions
mailing list