5

For example I have a text

Line1

Line3

Line5

Line6

And I need to replace the blank lines with a specific text, e.g. CoolText so the result would be

Line1
CoolText
Line3
CoolText
Line5
CoolText
Line6

How to accomplish this?

S.L. Barth
  • 8,058
  • 71
  • 49
  • 63
Henry The Least
  • 609
  • 3
  • 11
  • 20
  • I am not trying to remove the blank lines, I am trying to replace the blank lines with a specific text. Finding \r\n and replacing with CoolText does not accomplish this task, it only places CoolText at the end of each line and deletes the blank lines. – Henry The Least Jan 19 '13 at 23:51

1 Answers1

7

You can use the extended replacement feature in NotePad++. Search for doubled carriage return/line feed pairs (\r\n\r\n), and replace them with a carriage return/line feed pair, the replacement text, and another CR/LF pair (\r\nCoolText\r\n).

Here's the text file with the dialog set up for the replacement, before clicking "Replace All":

NPP Before Replace Image

Here are the results after clicking "Replace All":

enter image description here

Ken White
  • 120,522
  • 13
  • 212
  • 426
  • In case you have 2 and more empty lines one after another, you need to press "Replace All" button a few more times =) – Oleg Dec 12 '19 at 07:29