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

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!!
  • Comment on Re^2: Perl one-liner for array at bash shell

Replies are listed 'Best First'.
Re^3: Perl one-liner for array at bash shell
by Anonymous Monk on Aug 22, 2017 at 21:05 UTC
    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
        perl -naF, -le '$"=",";print "@F[0..$#F-1],$_" for split/[;\s]+/,$F[-1 +]'
        see $" and Slices