http://stackoverflow.com/questions/3134791/how-do-i-remove-newlines-from-a-text-file perl -p -i -e 's/\R//g;' filename