user1905941
user1905941

Reputation: 13

How to add the end of the first line with the starting of the second line in notepad

i am facing a problem with a list of lines in notepad as follows

i am having 1
0 groceries

i want the line as "i am having 10 groceries"

could any one please help me out using notepad++

Upvotes: 0

Views: 1775

Answers (2)

AdrianHHH
AdrianHHH

Reputation: 14047

You could join all similar line pairs with a regular expression find and replace.

Enter (i am having [0-9]+)\r\n([0-9]+ groceries) into the "Find what" box and enter \1\2 into the "Replace with" box. Then specify the Search Mode as "Regular Expression".

Changing the Find What text to be ([0-9])\r\n([0-9]) would allow join all lines that have a line-break between two digits.

In both cases I would suggest using the Replace button rather than the Replace-all to allow easy detection of any lines pairs that should not be joined.

Upvotes: 0

Bernhard Barker
Bernhard Barker

Reputation: 55609

If you just want to remove all new-line characters:

Go to the Replace window (Ctrl+H).

Select "Extended" under "Search Mode".

Find what: \r\n
Replace with: (nothing)

Click "Replace All".

\r\n is the standard new-line character on Windows. If you want to do this on Linux (or sometimes on Windows too), you may need just \n.

This may only work from Notepad++ 6 and onwards.

Upvotes: 1

Related Questions