Advertisement
cd62131

sumation with awk

Jul 5th, 2018
3,174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Awk 0.48 KB | None | 0 0
  1. #!/usr/bin/awk -f
  2. # chmod +x this_script.awk
  3. # ./this_script.awk test1.txt test2.txt test3.txt
  4. # note: please check data's line terminator(RS). "\r\n" or "\n"
  5. BEGIN{IGNORECASE = 1;RS="\r\n"}
  6. $3~/geno/{print$4,"",$5,"",$6,"","P","P";next}
  7. $3~/counts/{print$4,"",$5,"",$6;print"";next}
  8. $3~/mean/{a[0]=$4;a[2]=$5;a[4]=$6;next}
  9. $3~/sd/{a[1]=$4;a[3]=$5;a[i=5]=$6;next}
  10. /^#/||!NF||/^chr/||$3~/freq/{next}
  11. {a[++i]=$NF;next}
  12. END{for(j=0;j<=i;++j){if(j!=0){printf OFS}printf a[j]}print""}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement