多组一列数据的处理
作者:互联网
1、
root@DESKTOP-1N42TVH:/home/test3# ls a.txt root@DESKTOP-1N42TVH:/home/test3# cat a.txt chr168 0.5 0.66 0.77 0.3 chr254 0.6 0.3 0.89 chr678 0.658 0.5 chr344 0.53 0.596 0.65 0.68 root@DESKTOP-1N42TVH:/home/test3# awk -v RS='chr' 'NR!=1{sum = 0; for(i = 2; i <= NF; i++) sum += $i; print "chr"$1,sum/(NF-1)}' a.txt chr168 0.5575 chr254 0.596667 chr678 0.579 chr344 0.614
来源:https://zhidao.baidu.com/question/1577754045903923260.html
标签:test3,1N42TVH,多组,0.3,DESKTOP,处理,一列,home,root 来源: https://www.cnblogs.com/liujiaxin2018/p/16098196.html