perl -i.bak -pe 's/\r(?!\n)/\n/g; tr/\r//d' test.dat #### perl -i.bak -lpe 'tr/\r//d' test.dat