0

I have lines that are joined together and I want to split them.

Example of lines before:

:user1:[email protected]:4082e6739d188208d2450d1e03696b40:OdoA>D9e9VIOnP8^}M[e*FA)3!:Frankosh:[email protected]:1bf4e6d1462b89977cf774c3dc1c666f:|Lt&A/+?%My._Ft+Tw1B7(?'[Sw/F5
:user2˜…:[email protected]:ac9ae85d0ad2f6328507bac7357dfdf4:(;J`#PQVde}),G*WoV%y&7:]:calefonaso:[email protected]:08598769c7ee559e792be4d04e931140:7TJL|O}c:2YhJq?0[?4coLT~XjW"xm
:Ruziitto:[email protected]:fe71d6e50e0bb767a19e176c0d26eaed:rOSMJ|?~Y*jAp1#P\,p)h)t:s:killer87:[email protected]:4316edd511ea5d8b2a67748ded316497:z(=3;m#y0:+$WS\jY6u@!\WFyt{\Ia

Example of lines afterwards:

:user1:[email protected]:4082e6739d188208d2450d1e03696b40:OdoA>D9e9VIOnP8^}M[e*FA)3!
:Frankosh:[email protected]:1bf4e6d1462b89977cf774c3dc1c666f:|Lt&A/+?%My._Ft+Tw1B7(?'[Sw/F5
:user2˜…:[email protected]:ac9ae85d0ad2f6328507bac7357dfdf4:(;J`#PQVde}),G*WoV%y&7:]
:calefonaso:[email protected]:08598769c7ee559e792be4d04e931140:7TJL|O}c:2YhJq?0[?4coLT~XjW"xm
:Ruziitto:[email protected]:fe71d6e50e0bb767a19e176c0d26eaed:rOSMJ|?~Y*jAp1#P\,p)h)t:s
:killer87:[email protected]:4316edd511ea5d8b2a67748ded316497:z(=3;m#y0:+$WS\jY6u@!\WFyt{\Ia
1
  • 2
    If each entry had exactly 4 colons in it you could use this regular expression (:[^:]*:[^:]*:[^:]*:[^:]*) and replace it with \1\n. This will introduce a few empty lines but those are easy to remove.
    – Tesseract
    Sep 17, 2017 at 1:22

1 Answer 1

1

Assuming colon is the delimiter and there're no colons in the data:

  • Ctrl+H
  • Find what: ^((?::[^:]+){4}):
  • Replace with: $1\n:
  • Replace all

Explanation:

^           : begining of line
  (         : start group 1
    (?:     : start non capture group
      :     : a colon
      [^:]+ : 1 or more any character that is not a colon
    ){4}    : end group, must appear 4 times
  )         : end group 1
  :         : a colon  (To be sure to not add superfluous line break)

Replacement:

$1      : The content of group 1 (the first fourth columns in a line)
\n      : a line break, you could use \r\n for windows
:       : colon, at the beginig of new lines
  • check Match case
  • check Wrap around
  • check Regular expression
  • DO NOT CHECK . matches newline

Result for given example:

:user1:[email protected]:4082e6739d188208d2450d1e03696b40:OdoA>D9e9VIOnP8^}M[e*FA)3!
:Frankosh:[email protected]:1bf4e6d1462b89977cf774c3dc1c666f:|Lt&A/+?%My._Ft+Tw1B7(?'[Sw/F5
:user2˜…:[email protected]:ac9ae85d0ad2f6328507bac7357dfdf4:(;J`#PQVde}),G*WoV%y&7
:]:calefonaso:[email protected]:08598769c7ee559e792be4d04e931140:7TJL|O}c:2YhJq?0[?4coLT~XjW"xm
:Ruziitto:[email protected]:fe71d6e50e0bb767a19e176c0d26eaed:rOSMJ|?~Y*jAp1#P\,p)h)t
:s:killer87:[email protected]:4316edd511ea5d8b2a67748ded316497:z(=3;m#y0:+$WS\jY6u@!\WFyt{\Ia

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .