Advertisements
I am trying to use awk and if else statements simultaneously.
Expression in if else statements are evaluated to a whole number and giving wrong output.
I tried this
awk '{if ($4/$3 < 0.35) print "reverse"; else if ($3/$4 < 0..35) print "forward"; else print "unstranded" }' <<< "0 207212663 6541998518 259487717"
This is giving reverse
as ouput.
correct answer is unstranded
>Solution :
Invert the logic:
$ awk '{
if ($4/$3 > 0.35) print "reverse"
else if ($3/$4 > 0.35) print "forward"
else print "unstranded"
}' <<< "0 207212663 6541998518 259487717"
Disclaimer: As explained in comments, verify that this fits your needs, and it’s not a false positive output.
Output
forward