Mar 022009
 

Sponsored Link

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

Sponsored Link

 Posted by at 12:04 am

  8 Responses to “Flip – Convert text file line endings between Unix and DOS formats”

  1. But what’s wrong with dos2unix and unix2dos?

  2. 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?

  3. It is a lot simpler to use
    dos2unix and
    unix2dos programs

  4. What about tofrodos? I think it is much easier to use the commands ‘todos’ and ‘fromdos’.

    Enrico

  5. 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'

  6. Does this work with mac OSX 10.7 (Lion)?

  7. Doesn’t work with Lion and Mountain Lion (fromdos or dos2unix or unix2dos)

  8. No problem now

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>