chebe (
chebe) wrote in
command_liners2011-04-28 07:47 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[community profile]](https://www.dreamwidth.org/img/silk/identity/community.png)
Entry tags:
Removing Windows carriage-returns from text files
Hey all, don't think I've seen this here before, and I know there are many ways of doing this, so I thought, in a fit of geekery, that it might be fun to try and collect them all! Afterall everyone does have their own favourite programs.
I posted this at my own journal when I first came across it, but here's a new one as well;
I posted this at my own journal when I first came across it, but here's a new one as well;
sed -i 's/\r//' $file_name
perl -pi -e 's/\r\n/\n/g' $file_name
no subject
I like your methods too :)
Line-Feeds
Thank you for these.
I'll add them to my scripts collection.
Whenever possible, I convert word-processed documents and save text as "US-ASCII" with the Dell Workstation in my office and my PowerBook at home.
My favorite text-editor is vim, for which I use "!fmt" to format text within the document. That usually removes the Windows CR/LF.
Thanks, again.
Re: Line-Feeds
!fmt
no subject
dos2unix
andunix2dos
installed for this; they're pretty commonly found. It is, of course, a simple task to do yourself, but still :Ddos2unix and unix2dos
(no subject)
no subject
" remove CRs
map *@ :%s/^V^V^M$//^M
Where the ^V and ^M are the actual literal control characters. (I'm not completely sure there aren't nviisms hiding in that, so beware.) I wrote it for the specific purpose of editing cddb files in abcde.