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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login