in reply to read column in perl


Here is a one-liner for a Unix system:
$ paste file1 file2 | perl -lane 'print "@F[1,0,2,3]"' 1 a 6 11 2 b 7 12 3 c 7 13 4 d 8 14 5 e 9 23
Or this:
$ paste file1 file2 | awk '{print $2, $1, $3, $4}'

You can change the field separator in either example to suit.

--
John.

Replies are listed 'Best First'.
Re^2: read column in perl
by DentArthurDent (Monk) on Mar 08, 2005 at 12:54 UTC
    I wish I could ++ that 5 times. It showed me a new UNIX command, and the perl arguements at the same time. Great work!

    ----
    My mission: To boldy split infinitives that have never been split before!

      I like to remind people that Unix isn't there just to bootstrap perl. ;-)

      --
      John.

        It isn't??? Oh, well, I suppose sendmail is a useful function too...


        --
        Linux, sci-fi, and Nat Torkington, all at Penguicon 3.0
        perl -e 'print(map(chr,(0x4a,0x41,0x50,0x48,0xa)))'