# sql: count(1) group by $1
awk -F '\t' '{print $1}' data.txt | sort | uniq -c
# sql: count(1) group by $1,$2,$3
awk -F "\t" '{print $1 "\t" $2 "\t" $3}' data.txt | sort | uniq -c
# sql: count(distinct $1)
awk -F '\t' '{print $1}' data.txt | sort | uniq | wc -l
# sql: sum(if($1=0, 1, 0))
awk -F '\t' '{ if ($1 == 0) print }' data.txt | wc -l
# 以\t分割的文件有多少列(查看前5行)
awk -F '\t' '{print NF}' data.txt | head -n 5
# 查看第1列数据不为0的数据5行
awk -F '\t' '{ if ($1 != "") print $1}' data.txt | head -n 5
# 杀死xxx的多个子进程
ps aux | grep 'xxx' | awk '{ print $2 }' | xargs kill -9