And the output you showed in post #1 in this thread does not match your requirements where you said "I would like to extract the data in the same order of file2."
Note that the 1st line in your sample file2 is:
44137.00 48629.001
and the lines in your sample file1 that contain those values in character positions 20 through 38 are:
X 7494 11711 44137.00 48629.001 1 4321 44148.00 48210.00 49072.001
X 7494 11711 44137.00 48629.001 433 8641 44160.00 48210.00 49072.001
X 7494 11711 44137.00 48629.001 865 12961 44172.00 48210.00 49072.001
X 7494 11711 44137.00 48629.001 1297 17281 44184.00 48210.00 49072.001
X 7494 11711 44137.00 48629.001 1729 21601 44196.00 48210.00 49072.001
X 7494 11711 44137.00 48629.001 2161 25921 44208.00 48210.00 49072.001
Which matches the 1st six lines of output produced RudiC's script (including copying the trailing space characters that are present in file1 :
X 7494 11711 44137.00 48629.001 1 4321 44148.00 48210.00 49072.001
X 7494 11711 44137.00 48629.001 433 8641 44160.00 48210.00 49072.001
X 7494 11711 44137.00 48629.001 865 12961 44172.00 48210.00 49072.001
X 7494 11711 44137.00 48629.001 1297 17281 44184.00 48210.00 49072.001
X 7494 11711 44137.00 48629.001 1729 21601 44196.00 48210.00 49072.001
X 7494 11711 44137.00 48629.001 2161 25921 44208.00 48210.00 49072.001
X 7494 11511 44149.00 48617.002 1 4321 44148.00 48198.00 49060.001
X 7494 11511 44149.00 48617.002 433 8641 44160.00 48198.00 49060.001
X 7494 11511 44149.00 48617.002 865 12961 44172.00 48198.00 49060.001
X 7494 11511 44149.00 48617.002 1297 17281 44184.00 48198.00 49060.001
X 7494 11511 44149.00 48617.002 1729 21601 44196.00 48198.00 49060.001
X 7494 11511 44149.00 48617.002 2161 25921 44208.00 48198.00 49060.001
X 7494 11811 44137.00 48425.001 1 4321 44148.00 48006.00 48868.001
X 7494 11811 44137.00 48425.001 433 8641 44160.00 48006.00 48868.001
X 7494 11811 44137.00 48425.001 865 12961 44172.00 48006.00 48868.001
X 7494 11811 44137.00 48425.001 1297 17281 44184.00 48006.00 48868.001
X 7494 11811 44137.00 48425.001 1729 21601 44196.00 48006.00 48868.001
X 7494 11811 44137.00 48425.001 2161 25921 44208.00 48006.00 48868.001
X 7494 11611 44137.00 48641.001 1 4321 44148.00 47994.00 48856.001
X 7494 11611 44137.00 48641.001 433 8641 44160.00 47994.00 48856.001
X 7494 11611 44137.00 48641.001 865 12961 44172.00 47994.00 48856.001
X 7494 11611 44137.00 48641.001 1297 17281 44184.00 47994.00 48856.001
X 7494 11611 44137.00 48641.001 1729 21601 44196.00 47994.00 48856.001
X 7494 11611 44137.00 48641.001 2161 25921 44208.00 47994.00 48856.001
and that the 1st six lines of output you said you desired:
X 7494 11511 44137.00 48629.001 1 4321 44148.00 48198.00 49060.001
X 7494 11511 44137.00 48629.001 433 8641 44160.00 48198.00 49060.001
X 7494 11511 44137.00 48629.001 865 12961 44172.00 48198.00 49060.001
X 7494 11511 44137.00 48629.001 1297 17281 44184.00 48198.00 49060.001
X 7494 11511 44137.00 48629.001 1729 21601 44196.00 48198.00 49060.001
X 7494 11511 44137.00 48629.001 2161 25921 44208.00 48198.00 49060.001
do not contain any trailing spaces, and, even if they did, these lines do not appear anywhere in file1 in your sample data.
RudiC's code followed your stated requirements but did not produce the output you said you wanted to produce. So, are your requirements wrong, or is your sample output wrong?