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行寻址范围 August 17, 2014 sed模式空间与暂存空间 May 29, 2014 sed合并偶数行到上一行 May 30, 2015