source.txt内容:
C2S|CTCC|node1|49.32.100.10
S2C|CTCC|node3|49.32.100.10
C2S|CTCC|node1|49.32.100.10
C2S|CTCC|node2|49.32.100.10
C2S|CTCC|node3|49.32.100.10
C2S|CTCC|node3|49.32.100.10
脚标从1开始
统计某个文件shell:
cat source.txt | awk -F '|' '{print $3}'| sort | uniq -c | sort -nr > result.txt
统计某个文件夹shell:
find -type f | xargs cat | awk -F '|' '{print $52}'| sort | uniq -c | sort -nr >result.txt