linux-统计一个文件中出现的单词数

#!/bin/bash
if [ $# -ne ]
then
echo "Usage: $0 filename";
exit -
fi filename=$
egrep -o "\b[[:alpha:]]+\b" $filename | \
awk '{ count[$0]++ }
END{ printf("%-14s%s\n", "word", "count");
for(ind in count)
{ printf("%-14s%d\n", ind, count[ind]); }
}'
egrep -o "\b[[:alpha:]]+\b" $filename 可以得到文件中所有的单词 \b为单词边界标记符
上一篇:记一次RATEL脱壳配合Il2CppDumper解密完成的样本分析


下一篇:Install Linux Kernel - AT91SAM9260EK