[newline] How to break lines at a specific character in Notepad++?

I have a text file containing text like:

['22APR2012 23:10', '23APR2012 07:10', 1, 3, 0], ['22APR2012 23:10', '23APR2012 07:20', 1, 3, 0], ['22APR2012 23:15', '23APR2012 06:40', 0, 1, 0], ['22APR2012 
23:15', '23APR2012 06:40', 1, 3, 0], ['22APR2012 23:15', '23APR2012 06:40', 0, 1, 0], ['22APR2012 23:15', '23APR2012 07:00', 1, 3, 0], ['22APR2012 23:15', '23APR2012 
07:00', 0, 1, 0], ['22APR2012 23:20', '23APR2012 09:35', 0, 1, 0], ['22APR2012 23:20', '23APR2012 09:35', 1, 3, 0], ['22APR2012 23:20', '23APR2012 10:10', 1, 3, 0], 
['22APR2012 23:25', '23APR2012 05:35', 1, 3, 0], 

I want the lines break at ], characters:

['22APR2012 19:30', '23APR2012 00:25', 0, 1, 0], 
['22APR2012 19:35', '23APR2012 01:45', 1, 3, 0],
['22APR2012 19:50', '23APR2012 05:25', 1, 3, 0],
['22APR2012 19:50', '23APR2012 05:25', 0, 1, 0],
['22APR2012 19:55', '23APR2012 06:25', 1, 3, 0],

Is there a way to do it in Notepad++, or any other editor?

This question is related to newline notepad++ text-editor line-breaks

The answer is


Let's assume ], is the character where we wanted to break at

  1. Open notePad++
  2. Open Find window Ctrl+F
  3. Switch to Replace Tab
  4. Choose Search Mode to Extended
  5. Type ], in Find What field
  6. Type \nin Replace with field
  7. Hit Replace All
  8. Boom

I have no idea how it can work automatically, but you can copy "], " together with new line and then use replace function.


If the text contains \r\n that need to be converted into new lines use the 'Extended' or 'Regular expression' modes and escape the backslash character in 'Find what':

Find what: \\r\\n

Replace with: \r\n


Try this way. It got worked for me

  1. Open Notepad++ then copy your content
  2. Press ctrl + h
  3. Find what is should be ,(comma) or any character that you want to replace
  4. Replace with should be \n
  5. Select Search Mode -> Extended (\n, \r, \t, \0)
  6. Then Click on Replace All

If you are looking to get a comma separated string into a column with CR LF you wont be able to do that in Notepad++, assuming you didn't want to write code, you could manipulate it in Microsoft Excel.

If you copy your string to location B1:

A2 =LEFT(B1,FIND(",",B1)-1)
B2 =MID(B1,FIND(",",B1)+1,10000)

Select A2 and B2, copy the code to successive cells (by dragging):

A3 =LEFT(B2,FIND(",",B2)-1)
B3 =MID(B2,FIND(",",B2)+1,10000)

When you get #VALUE! in the last cell of column A replace it with the previous rows B value.

In the end your A column will contain the desired text. Copy and past it anywhere you wish.


Examples related to newline

How can I insert a line break into a <Text> component in React Native? Print "\n" or newline characters as part of the output on terminal Using tr to replace newline with space How to write one new line in Bitbucket markdown? Line break in SSRS expression How to insert a new line in Linux shell script? Replace CRLF using powershell How to write new line character to a file in Java What is the newline character in the C language: \r or \n? How to print values separated by spaces instead of new lines in Python 2.7

Examples related to notepad++

How to view Plugin Manager in Notepad++ How to format JSON in notepad++ CR LF notepad++ removal How to install a Notepad++ plugin offline? Find duplicates and delete all in notepad++ How to compare two files in Notepad++ v6.6.8 Notepad++ cached files location How to indent HTML tags in Notepad++ How to change background color in the Notepad++ text editor? How do I stop Notepad++ from showing autocomplete for all words in the file

Examples related to text-editor

Find duplicates and delete all in notepad++ How to run vi on docker container? How to run a program in Atom Editor? How to call VS Code Editor from terminal / command line What is the difference between Sublime text and Github's Atom Multiple select in Visual Studio? change cursor from block or rectangle to line? Javascript button to insert a big black dot (•) into a html textarea Vim multiline editing like in sublimetext? Edit a text file on the console using Powershell

Examples related to line-breaks

HTML5 tag for horizontal line break Split string in JavaScript and detect line break Match linebreaks - \n or \r\n? How to linebreak an svg text within javascript? What is the difference between a "line feed" and a "carriage return"? Bash: Strip trailing linebreak from output How to read a file without newlines? How to break lines in PowerShell? How do I specify new lines on Python, when writing on files? How to remove line breaks (no characters!) from the string?