When reading from the selection, use $% as the file name and print word addresses relative to the beginning of the file rather than relative to the beginning of the selection.