Find and replace the end of the line with "\ n" literally

I hope to use some kind of text editor to find all the "end of lines" in the document and replace them only with a sequence of "\ n" (for the convenience of converting to another file type). I tried both with Notepad ++ and with the text panel with little luck.

When using the regex mode in Notepad ++, for example, I type [Find: \ n] in the search field (which it will find successfully) and [Replace: \ Q \ n \ E] in the replace field (\ Q and \ E - literal search modifiers, as far as I can tell), without encouraging effects.

Is there an easy way to do this replacement?

+7
source share
3 answers

In the Notepad ++ Search and Replace dialog box (Ctrl-H), switch to Advanced mode.

From there, replacing \r\n with \\n , I should do it - if I understood your question correctly.

For example, I typed ...

 something something else blah 

... and then did it with Replace All, which left me:

 something\nsomething else\nblah 
+18
source

I know this is a pretty old question, but there is another simpler way to do the same if anyone is interested.

If you go into Notepad ++ and go to Edit> EOL Conversion, if you can convert from the current EOL to Unix style, Windows or Mac style.

  • Unix only \n
  • Windows \r\n
  • Mac only \r
+10
source

try the blue fish editor http://bluefish.openoffice.nl/index.html just copy and paste, no need to worry about \ r or \ n

0
source

All Articles