regexjedit

How to convert a csv list (horizontal) from vertical name value pair set


I have a list like this:

GTPYANJ         695848
GTPYANJ         27811
FPORTAL3        432532

I want to turn it into this using regular expressions:

GTPYANJ,695848,27811
FPORTAL3,432532

Suggestions?


Solution

  • load into jEdit (or Notepad++, or some other editor that can search/replace via regex.

    Step 1 is to make sure that the delimiter is a tab.

    Then, search for

    ^(.*)\t(.*)\n\1
    

    and replace that with

    $1\t$2,
    

    Repeat the find/replace all until no more matches are found.