Join lines with specific symbol
-
I have text like this
678,“Name”,2017
\n<strong>Country: </strong>UK
\n<strong>Save:</strong> UN.
679,“Name”,2019
\n<strong>Country: </strong>USA
\n<strong>Save:</strong> UNC.
\n<strong>Count:</strong> 3.And I need to make it look like this
678,“Name”,2017\n<strong>Country: </strong>UK\n<strong>Save:</strong> UN.
679,“Name”,2019\n<strong>Country: </strong>USA\n<strong>Save:</strong> UNC.\n<strong>Count:</strong> 3.So basically I want to join line that starts with “\n” with previous line and I don’t want to delete this “\n” symbol. Any ideas how to do this?
-
@Salamander931 said in Join lines with specific symbol:
So basically I want to join line that starts with “\n” with previous line and I don’t want to delete this “\n” symbol. Any ideas how to do this?
Using a regular expression in the “Replace” function we have:
Find What:(?-s)\R^(\\n.+)
Replace With:\1
So search mode must be regular expression. Click on the “Replace All” button to change the entire file.You will see the
\\
in the expression because the\
is regarded as a special character, so the additional\
escapes it, or reverts it to a normal character.Terry
PS since you didn’t show the example inside of a black box (read the “read me before posting”) it’s possible this might not work. I suspect you may have leading spaces on some lines.