I have very large data files (File1 and File2).
Search field1 of File1 into Field1 of File2.
If found then do Field1 of File1 MINUS Field1 of File2
if the answer is <= 0.003 (positive or negative) then
print that line from File1.
So what I thought was following:
-2.306 minus -2.305 is less than or equal to 0.003 than it pass
0.0121 minus 0.0123 is less than or equal to 0.003 than it pass
9.766 minus 9.767 is less than or equal to 0.003 than it pass
---------- Post updated 07-29-09 at 10:12 AM ---------- Previous update was 07-28-09 at 04:31 PM ----------
However, the last digit in field 2, 3 and 4 are different it fails.
If the difference of the last digit is less than or equal to .003 than I need to pass.
Any suggestion please.
Thanks,
Prashant
---------- Post updated at 02:37 PM ---------- Previous update was at 10:12 AM ----------
A general suggestion would be:
1.) grep line 1 of both files for the characters up to the pipe character. Save each search as a separate variable.
2.) Compare both variables and if they have the same content, proceed to grep-ing the rest of the contents of line 1 of each file putting each number between pipe characters into separate variables, or even better compare them right in the loop for the desired difference. You could send the output of the loop to standard output via echo at that point...