ABD : 5869 events, relative ratio : 1.173800E-01 , sum of ratios : 1.173800E-01
VBD : 12147 events, relative ratio : 2.429400E-01 , sum of ratios : 3.603200E-01
SDF : 17000 events, relative ratio : 3.400000E-01 , sum of ratios : 7.003200E-01
OIP: 14984 events, relative ratio : 2.996800E-01 , sum of ratios : 1.000000E+00
so, the values I want to compare are separated with a ':' followed by a space -- I want to use file1 as reference, and compare file2 value by value and line by line but comparing only columns 2,3 etc until the end of each line, and if I have a mismatch by a certain ratio (valueA/valueB) while comparing each given column on each given line do something, (actionA) otherwise do actionB
awk 'NR==FNR { a[$0]++; next }
($0 in a) { do stuff }'
This puts first1 into an array, then looks for each line of file2 inside of the array.. I am not sure what columns you mean to compare. All of them, it sounds like, individually?? And is that first column the one that should be used to actually compare data between the two files? Like, compare the numbers for ABD in file1 only to the numbers for ABD in file2? ...
Edit: Best way to show us is a small file1 and file2 example, with desired output.
Sorry if I was not clear -- I want to compare 1rst field after the first ':' from file1 with 1rst field after the fist ':' from file2 , then the same for the second fields etc etc on a line - by - line basis
So, you want to compare line1 of file1 to line1 of file2. You calculate a delta ratio between the two and perform an action whether they're within range or not?
The script works fine, I am just having problems doing something like
if \( b[3]/$3 < 0.96 \)
printf\(" \\n WARNING!! below tolerance %f for file %s\\n", b[3]/$3 , $1\)
inside the awk block, cannot recognize the $1 input, ie the first file... so, how can I do something if the ratio is below 0.95 for example ? Like removing the file etc etc