I have the following table:
CHR BP SNP CM AN1 1 15558213 rs2845371 0 -1.10837716961610 1 15558230 rs16981507 0 -1.13721847993853 1 15558586 rs5993924 0 -1.34239265871644 1 15563103 rs3016111 0 -1.61194237184708 I would like to select the highest 2% of the values in column 5, and when it is true, write 1 and when it is false, write 0.
I figured that I need to use the if...else command. However, I don't know how to define the first line (if col5= top2%)
if col5= top2% then awk '{$5=1 ; print ;}' file else awk '{$5=0 ; print ;}' $file fi I would be very grateful if you can direct me to the way to solve this.