Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hello everyone,
I am a newbie and hope you forgive if this question is simple to your eyes.
I have been looking at this code for some time:
perl -sple"BEGIN{open BIG};($undef,$l)=split;read(BIG,$_,$l)" -- -BIG=bigfile.dat index.dat >outfile.dat The index file contains two columns, one for the offset and the second for a number of characters to read. The code works fine but it seems to be processing the bigfile sequentially, by this I mean it starts at 0 reads the first value in column 2 of the index file and writes out that many characters, next it continues from there and writes out the next group of x characters as identified by the next value in column 2 of the index file.How can I force a reposition of the read inside the big file by using the value in column 1 of the index file anytime a new read has to occur? Can the logic be added to the one liner above? Additionally how do I add a CR to each record that is going to the output file?Thanks to all. In reply to Offset Reading - two files by gio001
|
|