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

OK, yes I understand your valid points. Here is a little history: when I originally asked you the question I was facing a problem on retrieving data from a large file whose record structure information was stored in an index file. At that time the structure of the index file was sequential that is the next record was always starting right after the end of the prior record, so no offset was actually involved. The code you supplied was perfectly doing the retrieval by sequentially picking up chunks from the big file. 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 understand your surprise and the disappointment for my ignorance, I can only say I wish I had more time to dedicate to the discovery of Perl abilities ..... Thanks for all you did

Replies are listed 'Best First'.
Re^3: Offset Reading - two files
by BrowserUk (Patriarch) on Dec 14, 2012 at 14:50 UTC
    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

      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.
      Hello, I know I should not be wasting your time, sorry. Goodbye