#!/bin/bash
grep -v ^# $i|awk ‘{sum[$1+=1]END{for(i in sum)print i"\t" sum[i]}‘ >chr_info
#按大小排序
sort -n chr_info
#某列求和
awk ‘{sum +=$2;END {print sum}‘ chr_info
#符合要求的某列求和
awk ‘/[0,9]/ {sum +=$2;END {print sum}‘ chr_info
#统计某项出现次数,第一列为chr1,第一列为chr2
awk ‘{if($1=="chr1") ++sum1;if($1=="chr2") ++sum2}END{print "00""\t"sum1"\n""01""\t"sum2}‘ $i