Debian Admin

Debian/Ubuntu Linux System Administration Tutorials,Howtos,Tips

  • RSS Subscribe

    subscribe to the Debian Admin RSS feed
  • Sponsors



  • Categories

  • Sponsors

  • Support DebianAdmin

    Amount $:
    Website(Optional):


  • Meta

  • Archives



Flip – Convert text file line endings between Unix and DOS formats

Posted by Admin on March 2nd, 2009

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

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

  • Share/Bookmark

Random Posts

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

  1. Steve Parker Says:

    But what’s wrong with dos2unix and unix2dos?

  2. KTG Says:

    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. John Says:

    It is a lot simpler to use
    dos2unix and
    unix2dos programs

  4. Enrico Says:

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

    Enrico

Leave a Reply

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