in reply to Re^2: Perl one-liner for array at bash shell
in thread Perl one-liner for array at bash shell

Don't get it, show what output you want?
  • Comment on Re^3: Perl one-liner for array at bash shell

Replies are listed 'Best First'.
Re^4: Perl one-liner for array at bash shell
by Anonymous Monk on Aug 22, 2017 at 21:11 UTC

    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
      perl -naF, -le '$"=",";print "@F[0..$#F-1],$_" for split/[;\s]+/,$F[-1 +]'
      see $" and Slices
        Same but shorter
        perl -naF, -le '$"=",";print"@F,$_"for split/[;\s]+/,pop@F'