perl -p -i -e 's/\x0D\x0A$/\n/g' datei.sh # for all sh scripts in current dir for i in *sh ; do perl -p -i -e 's/\x0D\x0A$/\n/g' $i; done