Assoc.txt
CHR SNP BP A1 TEST NMISS OR STAT P
1 rs2980319 766985 A ADD 4154 1.024 0.1623 0.8711
1 rs2980319 766985 A AGECAT 4154 1.371 6.806 1.003e-11
1 rs2980319 766985 A EV1 4154 1.68e-30 -17.51 1.2e-68
1 rs2980319 766985 A EV2 4154 3.42e-12 -7.966 1.645e-15
1 rs2980319 766985 A EV3 4154 0.03088 -0.5361 0.5919
1 rs2980319 766985 A EV4 4154 17.18 0.2873 0.7739
1 rs11260595 1028961 T ADD 4158 1.004 0.01069 0.9915
1 rs11260595 1028961 T AGECAT 4158 1.364 6.671 2.54e-11
1 rs11260595 1028961 T EV1 4158 1.318e-30 -17.52 1.043e-68
I want to get only the lines where TEST (Col. 5) has value "ADD"; then
I want to sort P (Col.9) in ascending order, but also keep the column headers intact without getting sorted out.
Using awk, I can do the following
>awk '{if($5=="ADD") {print $0}}' OFS='\t' Assoc.txt |sort -nrk9
This however, removes the Header Row
It also does not sort Col.9 properly, because I have values that are in scientific notation (3.457e-05) and decimals ( 0.0001029)