I have two text files that contain columnar data of the variety position-value, sorted by position.
Here is an example of the
If the files are sorted, step through them based on which one has the lower position.
Pseudocode:
read Apos, Aval from A # initial values
read Bpos, Bval from B
until eof(A) or eof(B)
if Apos == Bpos then
compare()
read Apos, Aval from A # advance both files to get a new position
read Bpos, Bval from B
fi
if Apos < Bpos then read Apos, Aval from A
if Bpos < Apos then read Bpos, Bval from B
end
You could also use join(1) to isolate the lines with common positions and process that at your leisure.