Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove linebreaks and replace them with a comma in Notepad++

I need some help in Notepad++ and regular expressions.

Example how it looks at the moment:

aaaaa
bbbb
cccccc

How I want it (remove breakpoints and replace them with a comma and a blank space):

aaaaa, bbbb, cccccc

I was told that I can do it by checking "Regular expression" and "matches newline" and;

Find what: "[\r\n]+"

Replace with:","

-> Replace All

However I can't find the "matches newline" in my Replace window. Do I need any plugins for it? The version of my Notepad++ is 5.7 (UNICODE).

like image 588
may.y Avatar asked Oct 03 '12 05:10

may.y


People also ask

How do you replace a line break in comma in notepad?

In the “Replace” window, click the “Find What” box and press Space. Then, place your cursor in “Replace With” and type the character that you'd like to replace space with, such as comma (“,”) or a command and a space for a human-readable format. When you're ready, click “Replace All” on the right.

How do you replace one line with a comma in Notepad?

In Notepad Plus Plus, when you have a list of strings and you want to have one line with these strings separated by a comma, you can use the Replace function. and you want this outcome: Then do this: CTRL + H to open the Replace window. Then select Regular Expression in Search Mode. In the Find What, enter [ ]+.

How do I remove a line break in Notepad++?

Not much complications are required for removing linebreaks using notepad++ Just select from end of line to the start of next line and press CTRL + H, you will get the text to replace and then replace it with, or your desired character

How do I remove a comma from a regular expression?

Open the find and replace dialog (press CTRL + H ). Then select Regular expression in the 'Search Mode' section at the bottom. There is a space after the comma. Where there are empty lines. If your lines have trailing blank spaces you should remove those first. The simplest way to achieve this is

How to remove duplicate lines in Notepad++ using line operations?

using line operations Notepad++ provides Inbuilt Line operations features. It removes the duplicate lines and output in the file. ```markup This is test content This is test content4 This is test content5 ``` Select Edit > Line Operation > Remove Consequitive Duplicate Lines It removes the Consecutive duplicate lines and output in the file.


2 Answers

Use the Extended search mode, replacing \r\n with ,

ScreenShot

like image 59
Michael Rodrigues Avatar answered Sep 30 '22 19:09

Michael Rodrigues


Not much complications are required for removing linebreaks using notepad++

Just select from end of line to the start of next line and press CTRL + H, you will get the text to replace and then replace it with , or your desired character

like image 26
niksvp Avatar answered Sep 30 '22 21:09

niksvp