Removing all line breaks and adding them after certain text
Asked Answered
S

5

66

I have text file in which I have to remove all line breaks, and later add new ones after each text </row>. how could I do that using replace tool?

Shari answered 21/12, 2012 at 11:26 Comment(2)
What is "later", and what is "each text". How do you delimit the latter? An example would be welcome...Listerism
After removing all breaks, I need to add them, but only after text which is multiply definded in diferend places as "</Row>"Shari
L
129

You need to that in two steps, at least.

First, click on the ¶ symbol in the toolbar: you can see if you have CRLF line endings or just LF.

Click on the Replace button, and put \r\n or \n, depending on the kind of line ending. In the Search Mode section of the dialog, check Extended radio button (interpret \n and such). Then replace all occurrences with nothing (empty string).

You end with a big line...

Next, in the same Replace dialog, put your delimiter (</Row>) for example and in the Replace With field, put the same with a line ending (</Row>\r\n). Replace All, and you are done.

Listerism answered 21/12, 2012 at 12:33 Comment(1)
Thanks but can you tell me how to find several line breaks with data? That also has 4 empty spaces after line break? Like here I have 2: \n daily ,\n 0.8Dermatosis
G
38

You can also go to Notepad++ and do the following steps:

Edit->LineOperations-> Remove Empty Lines or Remove Empty Lines(Containing blank characters)

Gustatory answered 14/8, 2015 at 11:34 Comment(1)
works, awesome useful when working with Ftp client that in some cases inserts you breaklines in your filesMaravedi
W
29

You can also try this in Notepad++

  • Highlight the lines you want to join (ctrl + a to select all)
  • Choose Edit -> Line Operations -> Join Lines
Withdrew answered 13/11, 2017 at 8:49 Comment(2)
Instead of using the menu, you can just use CTRL + J after highlighting the lines.Tincal
Thank you so much! I didn't know about this.Selfregulated
C
7
  • Open Notepad++
  • Paste your text
  • Control + H

In the pop up

  • Find what: \r\n
  • Replace with: BLANK_SPACE

You end up with a big line. Then

  • Control + H

In the pop up

  • Find what: (\.)
  • Replace with: \r\n

So you end up with lines that end by dot

And if you have to do the same process lots of times

  • Go to Macro
  • Start recording
  • Do the process above
  • Go to Macro
  • Stop recording
  • Save current recorded macro
  • Choose a short cut
  • Select the text you want to apply the process (Control + A)
  • Do the shortcut
Conation answered 7/11, 2017 at 22:50 Comment(0)
A
3

I have achieved this with following
Edit > Blank Operations > Remove Unnecessary Blank and EOL

Aminta answered 21/5, 2018 at 16:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.