用shell处理以下内容
1、按单词出现频率降序排序!
2、按字母出现频率降序排序!
the squid project provides a number of resources toassist users design,implement and support squid installations. Please browsethe documentation and support sections for more infomation
str="the squid project provides a number of resources toassist users design,implement and support squid installations. Please browsethe documentation and support sections for more infomation"
function word() {
echo $str |sed 's#[^a-zA-Z]#\n#g'|grep -v "^$"|sort|uniq -c|sort -rn -k1
}
function string() {
echo $str |grep -o "."|egrep -v " |^$|[^a-zA-Z]"|sort|uniq -c|sort -rn -k1
}
case $1 in
word)
word
;;
string)
string
;;
*)
echo "arg {word | string}"
esac