Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a file with a mix of CRLF and LF, and wish to remove the LF. I am new to Notepad++ and just downloaded V6.23.

I'm using the search/replace dialogue box in extended mode. It will find and count the CR LF (using \r\n) but if I do a replace (to e.g. a blank or \r) nothing happens, and a replace all says it has replaced 0 occurrences. There are around 1000 CRLF in file and may be 100 lone LF.

Any ideas?

share|improve this question
    
So you want to replace CRLF with CR, and LF with a space (or just delete standalone LFs)? Also, does it have to be via Notepad++ only? –  Karan Feb 2 '13 at 20:53
    
I wish to delete the standalone LF. It odes not have to be Notepad++, although I don't understand why Notepad++ can't seem to do this. –  Alan Feb 3 '13 at 8:53
    
a guide for notepad2 that i use: blog.jtbworld.com/2011/01/… –  Hayden Thring Mar 20 '14 at 1:29

4 Answers 4

Task: File has a mix of CRLF and LF, and you want to end up with only CRLF and delete all standalone instances of LF.

  1. File:
    1

  2. File (Show All Characters):
    2

    Now if you delete only the standalone LF at the end of Line 3, you should end up with Lines 3 and 4 joined together, with the rest of the line endings unaffected.

  3. Replace #1 (\n with (blank)):
    3

  4. File after Replace #1:
    4

  5. Replace #2 (\r with \r\n):
    5

  6. File after Replace #2:
    6

  7. Final result:
    7

Conclusion: Notepad++ seems to be able to do the job just fine!

share|improve this answer
    
Holy crap. This saved my butt. I was tearing my hair out trying to make a files with mixed line endings and this helped so much! AWESOME XD –  Jeshii Jul 9 at 4:50
    
THANKYOU SO MUCH! I've just spent hours working on a code project which Notepad++ led me to believe was full of double spaces. It was only on compiling (12,000 lines which had "duplicates removed plus new code) that I realised it was line breaks bad line breaks. You've just saved me hours of work! If I could upvote more than once, I definitely would! –  Fazer87 Jul 12 at 20:06

In the Notepad++ menubar click Edit -> EOF Conversion -> Old Mac format to format for entire files.

share|improve this answer

You can just copy everything to wordpad, create a new text file with notepad++ and paste it back to the new file from wordpad. Every line should have CR now.

share|improve this answer

In the find dialog there are three Search Modes, namely Normal, Extended (\n, \r, \O, \x...) and Regular expression. Mine defaulted to Normal but you need Extended for the escape characters.

share|improve this answer

Your Answer

 
discard

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.