Thursday, April 3, 2008
Linux flip command - alternative of dos2unix,unix2dos
I was struggling to install unix2dos and dos2unix(debian tofrodos package) on my debian box, then I came across "flip" command which does the same thing.
Usage:
----------
flip - do newline conversions between **IX and MS-DOS
-u Convert to **IX format (CR LF => LF, lone CR or LF unchanged, trailing control Z removed,
embedded control Z unchanged).
-m Convert to MS-DOS format (lone LF => CR LF, lone CR unchanged).
A example. myfile.txt is a dos file with ^Ms at the end of each line.
$ file myfile.txt
myfile.txt: ASCII text, with CRLF, LF line terminators
$ flip -u myfile.txt
$ file myfile.txt
myfile.txt: ASCII text
Again converting to dos format:
$ flip -m myfile.txt
$ file myfile.txt
myfile.txt: ASCII text, with CRLF line terminators
Subscribe to:
Post Comments (Atom)
© Jadu Saikia www.UNIXCL.com
2 comments:
To install flip on your ubuntu:
$ sudo apt-get install flip
I think it is more handy to use sed.
dos2unix:
sed -i 's/\r//' file
unix2dos:
sed -i 's/\n/\n\r/' file
Post a Comment