Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing all line breaks and adding them after certain text

Tags:

notepad++

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?

like image 455
Tautvydas Avatar asked Dec 21 '12 11:12

Tautvydas


People also ask

How do I mass remove a line break in Word?

Or, press Ctrl+* (or Ctrl+Shift+8). In Word for Mac, go to the Home tab and select Show all nonprinting characters. All section breaks become visible in the document. Place the cursor to the left of break you want to remove, then press Delete.

How do I remove all new lines from a string?

The strip() method will remove both trailing and leading newlines from the string. It also removes any whitespaces on both sides of a string.

How do I get rid of line breaks in Excel?

Place the cursor in the 'Find what' field and use the keyboard shortcut – Control + J (hold the Control key and press the J key). You may not see anything, but this puts the line break character in the 'Find what' field. In the replace field, enter a comma followed by a space character (, ) Click on Replace All.


5 Answers

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.

like image 189
PhiLho Avatar answered Oct 19 '22 09:10

PhiLho


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

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

like image 35
Orchid Avatar answered Oct 19 '22 07:10

Orchid


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
like image 40
Ismail Akar Avatar answered Oct 19 '22 07:10

Ismail Akar


  • 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
like image 22
Daniel Botero Correa Avatar answered Oct 19 '22 09:10

Daniel Botero Correa


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

like image 37
Denish Thummar Avatar answered Oct 19 '22 08:10

Denish Thummar