Karellen's Unix Blog
Just my personal notepad...
Pages
Blog
Childhood's End
Magazine
Contact
Copyright
About
Sunday, April 22, 2012
Remove carriage return ^M from a text file
Sometimes I have text files with a trailing carriage return character like this:
# vi file.txt
...
"foo"
^M
"foo"
^M
...
To remove them I use sed (when dos2unix is not available):
# cat file.txt | sed 's/\r//' > new.txt
# vi new.txt
...
"foo"
"foo"
...
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)