in reply to filter one file based on another

The part that is confusing (to me, at least) is: what do you mean when you say:

Then I would need to keep the text from position 40 to 60, and so on.

Are you supposed to produce a distinct output for each line (each set of positions) in the second file (e.g. open one output file for "0 20", then another output file for "40 60", etc)? If not that, then what do you mean by "keep"? Give us a little more of the "big picture"...

Replies are listed 'Best First'.
Re^2: filter one file based on another
by coldy (Scribe) on Aug 18, 2008 at 23:20 UTC
    Okay, sorry I was trying to keep it succinct. Thanks for the interest. The original data is multiple alignments of DNA sequences, in blocks- 4 lines to a block corresponding to 4 different species. Each line contains the position of the sequences (and also other descriptives in the first few fields). The last field is the sequence. So by 'keep' I mean dont filter/remove and place that block into the hash I described earlier, so I can then process elsewhere in the program. The filtering is based on the second file containing positions of the first sequence in the blocks (the reference sequence) which I need to 'keep'. Is this more clear?