in reply to Re^2: Offset Reading - two files
in thread Offset Reading - two files

Now the structure of the big file has been changed by the vendor and there is extraneous data in between each record for which I have to make use of the offset information each time before I can get the record I am interested in.... I wish I had more time to dedicate to the discovery of Perl abilities

That change appears to have happened 20 months ago. How have you been handling the problem in the interim?

Have you heard of seek?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong

Replies are listed 'Best First'.
Re^4: Offset Reading - two files
by gio001 (Acolyte) on Dec 14, 2012 at 15:04 UTC
    Hello, I have tried this, with no success:

    perl -sple"BEGIN{open BIG};($1,$2)=split;seek(BIG,$1,$2);read(BIG,$_,$2)" -- -BIG=bigfile.dat index.dat >outfile.dat

    What I asked '20 months' ago was not related to the change that occurred recently. Thanks

      seek does not take a length ($2 as its third parameter. If you changed that to:

      perl -sple"BEGIN{open BIG};($1,$2)=split;seek(BIG,$1,$2);read(BIG,$_,0 +)" -- -BIG=bigfile.dat index.dat >outfile.dat

      It might work.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        I have tried:

        perl -sple 'BEGIN{open BIG};($1,$2)=split;seek(BIG,$1,0);read(BIG,$_,$2)' -- -BIG=bigfile.dat index.dat >outfile.dat

        and I received the following:

        Modification of a read-only value attempted at -e line 1, <> line 1

        Thanks,
Re^4: Offset Reading - two files
by gio001 (Acolyte) on Dec 14, 2012 at 15:06 UTC
    Hello, I know I should not be wasting your time, sorry. Goodbye