Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Somehow, some 40 files (mostly Python modules) in my project have \r\n (Windows style) as line endings. I'd like to change them to \n (Unix style) line endings, but Komodo Edit doesn't appear to provide a way change existing files' line endings, and a simple regexp find and replace using Komodo doesn't work either.

share|improve this question

3 Answers 3

up vote 6 down vote accepted

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.

share|improve this answer
Excellent, thanks. I ended up spendin 20 minutes last night changing them by doing open file -> copy contents -> command w -> close and delete file -> command shift t (which prompts to recreate the file) -> paste contents -> save. I got each one down to about 8 seconds by the end lol, but wasted time early on doing extra steps. – orokusaki May 3 '12 at 21:49

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

share|improve this answer
Thanks swatso33 – orokusaki May 3 '12 at 2:09

At I give a macro that changes the line-end setting and the actual line-endings when a file that is under Git SCC is opened in Komodo.

You can also modify that macro to quickly update all loaded files.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.