This program converts line endings of text files between MS-DOS and **IX formats. It detects binary files in a nearly foolproof way and leaves them alone unless you override this. It will also leave files alone that are already in the right format and preserves file timestamps. User interrupts are handled gracefully and no garbage or corrupted files left behind. ‘flip’ does not convert files to a different character set, and it can not handle Apple Macintosh line endings (CR only). For that (and more), you can use the ‘recode’ program (package ‘recode’).
Install flip in debian
#apt-get install flip
This will complete the installation.
Flip Syntax
flip -h
flip -umvtsbz file
Available option
-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)
-h give a help message
-v be verbose, print filenames as they are processed
-t touch files (don’t preserve timestamps)
-s strip high bit
-b convert binary files too (else binary files are left unchanged)
-z truncate file at first control Z encountered
Flip Examples
file.txt is a dos file with ^Ms at the end of each line.
file file.txt
file.txt: ASCII text, with CRLF, LF line terminators
1)flip -u file.txt
file file.txt
file.txt: ASCII text
Again converting to dos format
2) flip -m file.txt
file file.txt
file.txt: ASCII text, with CRLF line terminators
This command is also called alternative to dos2unix,unix2dos commands
But what’s wrong with dos2unix and unix2dos?
There’s even more powerful tool named konwert.
I do agree with Steve, what’s wrong with the most standard and popular tools that can be found in most of UNIX and Linux systems?
It is a lot simpler to use
dos2unix and
unix2dos programs
What about tofrodos? I think it is much easier to use the commands ‘todos’ and ‘fromdos’.
Enrico
This works extremely well, with the added benefit of not needed an additional command installed, AND will not mangle a file that isn’t dos line endings:
tr -s '1512\n\r' '\n'
Does this work with mac OSX 10.7 (Lion)?
Doesn’t work with Lion and Mountain Lion (fromdos or dos2unix or unix2dos)
No problem now
Is there a way to have flip work on the standard output from cat’ing multiple files together or do you have to save the output of cat to a temp file first and then flip it?