awk重复行 awk只输出文本中重复的行 root@bwhhkle:~# cat xx 1xm 1xm 2 3ytd 3ytd 4 root@bwhhkle:~# awk 'a[$0]++' xx 1xm 3ytd 输出重复的行和重复行的总数 root@bwhhkle:~# awk '{a[$0]++}END{for(i in a)print a[i],i}' xx 1 4 2 1xm 2 3ytd 1 2 Tags: awk, awk详解 Read more articles Previous Postawk偶数行 Next Postawk偶数行二 You Might Also Like sed -n选项 September 16, 2015 bm支付更新脚本 July 10, 2019 sed行寻址范围 August 17, 2014