Notepad ++ remove CR LF tag and find particular string and place data after it on a new line

notepadregex

I have a file that I'm cleaning up, the file structure is kinda corrupted but there is a possible way of fixing.

Problem

1|firstname|lastname CRLF    
|address|Tel|1|firsname|lastname|address|Tel|

Theoretically this problem could be solved by removing the CRLF and find the second |1| in a line and move it to a new line. I tried doing this manually but I later noticed that the file is big and it's goning to take some time to cleanup.

I need an output to be like this:

1|firstname|lastname|address|Tel 
1|firstname|lastname|address|Tel

Best Answer

I've found a two step solution:

  1. remove line breaks:
    • open find / replace dialog (CTRL+H)
    • select "regular expression"
    • find what \R
    • Replace to (nothing)
    • press "replace all"
  2. insert line break before each |1|:
    • find what: \|1\|
    • replace to: \n1|
Related Question