How to break lines at a specific character in Notepad++?
NewlineNotepad++Text EditorLine BreaksNewline Problem Overview
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?
Newline Solutions
Solution 1 - Newline
- Click Ctrl + h or Search -> Replace on the top menu
- Under the Search Mode group, select Regular expression
- In the Find what text field, type
],\s*
- In the Replace with text field, type
],\n
- Click Replace All
Solution 2 - Newline
> Let's assume ],
is the character where we wanted to break at
- Open
notePad++
- Open
Find window
Ctrl+F - Switch to
Replace
Tab - Choose
Search Mode
toExtended
- Type
],
inFind What
field - Type
\n
inReplace with
field - Hit
Replace All
- Boom
Solution 3 - Newline
Try this way. It got worked for me
- Open Notepad++ then copy your content
- Press
ctrl + h
- Find what is should be ,(comma) or any character that you want to replace
- Replace with should be \n
- Select Search Mode -> Extended (\n, \r, \t, \0)
- Then Click on Replace All
Solution 4 - Newline
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
Solution 5 - Newline
I have no idea how it can work automatically, but you can copy "], " together with new line and then use replace function.
Solution 6 - Newline
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.