in reply to Re: Merging 3 files
in thread Merging 3 files

The correct result should look like this:
1 RO -54.68 838.75 2 SC -54.68 725.77 3 TR -54.61 89.65 to the last number in file#1
The following should be stripped from file number 2 and 3 SVO AIN 0 SLD AIN 1

Replies are listed 'Best First'.
Re: Merging 3 files
by b10m (Vicar) on Dec 18, 2003 at 12:04 UTC
    First of all, file1 contains 31 lines, while the other two files contain 33 lines. This might be because the files are actually way bigger and you decided not to post more, or there *is* a difference, and you should check wheter you really want to join these files.

    A nice GNU/non-Perlish way would be to do it straight from the command prompt with a few simple commands.
    $ nl file2 > f2; nl file3 > f3; join -o 1.5,2.5 f2 f3 | paste file1 -
    You might even pipe it to sed to get the formatting done a little nicer, but that's up to you :)

    Not a Perl way, but a quick-n-dirty way to get the requested output.
    --
    b10m
      A nice GNU/non-Perlish way ...
      Not a Perl way ...

      On the contrary, that's exactly a perlish way. Remember, TMTOWTDI includes not using perl (right tool for the job and all that).