0

I have a file where i need to take varying number of lines and concatenate into one. It could be two, three, or four lines that require concatenation. There is a common set of characters (say 'xxx') that begin the first line of each set of lines i want to concatenate. Is there a means in notepad++ to look for 'xxx' and concatenate every following line until the next 'xxx' is detected?

I should add i also have a value 'yyy' at the end of the each 'last line' that might be useful?

1 Answer 1

0

Please remember that real examples are always the best examples ;)

I don't know whether it's possible to modify the match before replacing in notepad++, but if the number of line to concatenate is limited to four, you could just run these four search & replace operations:

search: ^(xxx.*)\n(.*yyy)$ replace: \1\2

search: ^(xxx.*)\n(.*)\n(.*yyy)$ replace: \1\2\3

search: ^(xxx.*)\n(.*)\n(.*)\n(.*yyy)$ replace: \1\2\3\4

and so on.

if anybody needs this for a high number of lines, please comment and I'll do some research on this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.