i have to check the unique lines on the basis of 4rth field (numerical field) which is always after abc in both files. i should check whether the value is matching with the line in other file (might have differet order) within +/- 100 range. As in example
awk 'FNR == NR { # Accumulate records from 1st file.
f1[++n1] = $0
low1[n1] = $4 - 100
mid1[n1] = $4
high1[n1] = $4 + 100
next
}
{ # Accumulate records from 2nd file
low2[++n2] = $4 - 100
high2[n2] = $4 + 100
# Look for lines in 1st file that are in range of $4 in 2nd file
for(i = 1; i <= n1; i++)
if(($4 > low1) && ($4 < high1))
next # match found
# This line is unique.
print $0 > "UniqueIn2ndFile"
}
END { # Look for lines in 2nd file that are unique versus 1st file
for(j = 1; j <= n1; j++) {
for(i = 1; i <= n2; i++)
if((mid1[j] > low2) && (mid1[j] < high2))
break # match found
if(i > n2) print f1[j] > "UniqueIn1stFile"
}
}' file1 file2