in reply to Perl one-liner for array at bash shell

perl -naF, -le 'print "$F[0],$_" for split /[;\s]+/,$F[1]'

Replies are listed 'Best First'.
Re^2: Perl one-liner for array at bash shell
by Anonymous Monk on Aug 22, 2017 at 21:03 UTC
    Awesome works perfectly. One follow on questions... say I wanted to print the entire line except instead of just $F[0].... the $_ variable now pertains to the split function, so how to print the whole line? Thanks!!
      Don't get it, show what output you want?

        If you remove the cut function from the above example I gave ( and thus have many fields in addition to the two we were discussing specifically in your solution)

        #entire rest of line#,ftsI,DB00303 #entire rest of line#,HDC,DB00114; DB00117 #entire rest of line#,F13A1,DB01839; DB02340; DB11311; DB13151
        into
        #entire rest of line#,ftsI,DB00303 #entire rest of line#,HDC,DB00114 #entire rest of line#,HDC,DB00117 #entire rest of line#,F13A1,DB01839 #entire rest of line#,F13A1,DB02340 #entire rest of line#,F13A1,DB11311 #entire rest of line#,F13A1,DB13151
        download