Search code examples
notepad++

Add commas between spaces in each line


I have a file with 30,000 lines that look like such...

123456 123 firstname lastname

I am trying to make them all look like

123456,123,firstname,lastname

How would I do that to a large amount of lines in notepad++


Solution

  • Step 1: Open your text file

    Step 2: Go to Search > Replace or use Ctrl+H

    Step 3: Type (space) in Find what and (comma) in Replace with box with Search mode as normal. Then Replace All.

    Step 4: Spaces are replaced with commas. Save the changes in your file

    Note: Using \s with search mode regular expression will replace all tabs, spaces, and EOL (end of a line) with commas and your output will come in a single line.