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 browsing a log file in notepad++. The file has \r\n wherever a new line should start, but notepad just displays the \r\n characters:

[Header]\r\n2011-04-23 13:14:53,867 [1] DEBUG Themis.Program Enter application
2011-04-23 13:14:57,505 [1] DEBUG Themis.Program Exit application
[Footer]\r\n[Header]\r\n2011-04-23 13:23:15,690 [1] DEBUG Themis.Program Enter application

I'd like it to display it like this:

[Header]
2011-04-23 13:14:53,867 [1] DEBUG Themis.Program Enter application
2011-04-23 13:14:57,505 [1] DEBUG Themis.Program Exit application
[Footer]
[Header]
2011-04-23 13:23:15,690 [1] DEBUG Themis.Program Enter application

Is it possible to do this. Is there maybe another app that can do that?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Replace regexp \\r\\n with \n.

share|improve this answer
    
This works, but I don't want to do any replacements. Since I can control the log file contents, what should I log instead of \r\n to get notepad to recognize as 'new line'? –  Yoav Apr 25 '11 at 14:50
1  
@Yoav: Make your program write real newline characters instead. –  grawity Apr 25 '11 at 15:13
    
\r\n is 0x0D and 0x0A, or 0x0D0A. In Unicode, this is CR (U+000D) followed by LF (U+000A). Depending on your programming language, the existence of the backslashes and characters "\r\n" may indicate that you have some option set incorrectly. For example, in Python, if you have your string marked as "raw," it won't respect your newline code. –  Dane Aug 26 '13 at 13:59
add comment

You can do it in 2 steps

Press CTRL + H to open Replace window

1) First make sure that the Search Mode is in Normal mode. Then replace \r\n with some meaningless random word such as: abcdefg (which you're sure that is not within your text)

2) Then change the Search mode to Extended or Regular expression mode and replace this word with \n

share|improve this answer
add comment

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.