How do I convert all EOL (dos->unix) of all files in a directory and sub-directories recursively without dos2unix
? (I do not have it and cannot install it.)
Is there a way to do it using tr -d '\r'
and pipes? If so, how?
Just change "Search Mode" to "Extended", and you can work with EOL (\r\n in Windows or \n in Unix), tabs (\t), etc. You can also use the Find in Files tab of the dialog to do the replace across multiple files.
To write your file in this way, while you have the file open, go to the Edit menu, select the "EOL Conversion" submenu, and from the options that come up select "UNIX/OSX Format". The next time you save the file, its line endings will, all going well, be saved with UNIX-style line endings.
ls -R : Use the ls command to get recursive directory listing on Linux.
If you want to automatically run dos2unix on hidden files and folders, you can use find or dos2unix ** **/. * The **/. * will expand only the hidden files and folders, including .
For all files in current directory you can do it with a Perl one-liner: perl -pi -e 's/\r\n/\n/g' *
(stolen from here)
EDIT: And with a small modification you can do subdirectory recursion:
find | xargs perl -pi -e 's/\r\n/\n/g'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With