且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

awk +如何在列中查找重复项?

更新时间:2022-11-13 14:18:31

这将为您提供重复的代码

This will give you the duplicated codes

awk -F, 'a[$5]++{print $5}'

如果您只对重复代码的计数感兴趣

if you're only interested in count of duplicate codes

awk -F, 'a[$5]++{count++} END{print count}'

要打印重复的行,请尝试

To print duplicated rows try this

awk -F, '$5 in a{print a[$5]; print} {a[$5]=$0}'