Recursive convert dos newlines to unix ones with dos2unix


$ find . -type f -exec dos2unix {} \;

Remember to install dos2unix first :)

8 Comments.

  1. Bangon Kali

    This is how you avoid converting every file. You can use regular expressions to filter the files you wish to convert. My example is what i used to convert all of my PHP files to Unix.

    find . -name \*.php -exec /usr/bin/dos2unix ‘{}’ \;

    For more information you can visit this site: http://tinyurl.com/p3gzpc

  2. I found this worked

    $ find . -type f -exec dos2unix {} {} \;

    Will convert the original file, keep the name

    the

    $ find . -type f -exec dos2unix {} \;

    just displays the file in unix format in solaris

  3. Didn’t really work very well for me. I used the following command instead:

    $ dos2unix `find ./ -type f`

    (note that it’s backtick (`) and not single quote (‘))

  4. very useful and perfect command, i tried on RHEL 4 and it works well, save my lots of time

    Thanks!!!!!!!!!

  5. Nice! u save my life! :D

  6. Wow!! That was very useful, thanx a lot!!!!!!!!!!!

  7. That was really handy. Thanks!