Tag Archives: Perl

“dos2unix” function for multiple files using Perl

Changing line endings from DOS to UINX for a single file is easily done with the dos2unix command in most *NIX systems. Doing the same on a whole folder of files is however a little more tricky. To solve that problem I stumbled across this solution made in Perl:

perl -pi -e 's/\cM$//' *

Just run it from inside the folder which files you want to convert and “Bob’s your Uncle” 😉