2

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)

2 Answers2

1

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++

Ian W
  • 353
0

How do I removed linebreaks in Notepad++?

I can't give you a perfect solution as your example input is incomplete, but you can start with the following.

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

  • Set "Find what" to \r\n +

  • Set "Replace with" to nothing

  • Enable "Regular expression"

  • Click "Replace All"

    Image

  • Set "Find what" to \r\n\r\n

  • Set "Replace with" to \r\n

  • Enable "Regular expression"

  • Click "Replace All"

    enter image description here

Before:

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

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

After:

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

Further reading

DavidPostill
  • 162,382