How can I replace all \r\n with \n using Komodo Edit
There is actually a built-in feature for this in Komodo, but it's hard to find.
Right-click the Edit
tab select Current File Settings
. Under File Settings
, change "Line Endings" to UNIX (\n) and de-select "Preserve existing line endings".
This is fine for individual files, but it would be a bit of a hassle if you were trying to do several files as a batch. For that, you could wrap some of swatso33's suggestions into a saved command using interpolation shortcuts.
UPDATE (2014-10-13): There is now an option: Clean Line Endings
under the Code
tab.
You can do this with either perl or sed using:
perl -pe 's/\r?\n|\r/\r\n/g' inputfile > outputfile # Convert to DOS.
perl -pe 's/\r?\n|\r/\n/g' inputfile > outputfile # Convert to UNIX.
sed -e 's/$/\r/' inputfile > outputfile # UNIX to DOS (adding CRs on Linux based OS that use GNU extensions).
sed -e 's/\r$//' inputfile > outputfile # DOS to UNIX (removing CRs on Linux based OS that use GNU extensions).
perl -pe 's/\r?\n|\r/\r/g' inputfile > outputfile # Convert to old Mac.
Code snippet is from http://en.wikipedia.org/wiki/Newline#Conversion_utilities