Excel – How to remove linebreaks in Notepad++? in long text

linebreaksmicrosoft excelnotepad

I would like to know if is a method to remove linebreaks in Notepad++ aside from

 select  and   cntrl + J 

that is already explain here

How to remove linebreaks in Notepad++?

the Problem is that im trying to do a DML throught Excel to Notepad++ and when i copy the cells (from excel to notepad ++) it look like like this

-- Input 

 Insert into  table (
     line 1,
     line 2,
     line 3 ..

 Insert into  table (
     line 1,
     line 2,
     line 3..


--Output 

   Insert into table ( line1, line2,..)
   Insert into table (line1,line2,...)
    ...

so select each insert and make cntr + J is of course a solution but I wonder if there is any better that dont make me doing Manual 1 to 1 (because the DML in Excel could have like 1000 rows)

Best Answer

Your example is very specific and my not be accurate, but assuming it is ...

<space>Insert

or

<many spaces><some value>

You want to leave the single space lines alone, remove \n from the rest.

  • Menu "Search" > "Replace" (or Ctrl + H)

  • Set "Find what" to "\n[space][space]*"

  • Set "Replace with" "[nothing]"
  • Enable "Regular expression"
  • Click "Replace All"

Where [space] is an actual space. That takes any pattern with at line break, followed by least 2 spaces and flattens it out. Then fix the blank space on the first line.

For reference: How to use regular expressions in Notepad++

Related Question