ITPub博客

首页 > Linux操作系统 > Linux操作系统 > [Shell] 统计字符串出现的次数和排序(cut,sort,uniq)

[Shell] 统计字符串出现的次数和排序(cut,sort,uniq)

原创 Linux操作系统 作者:tolilong 时间:2016-03-22 13:46:58 0 删除 编辑
对tt3文本中出现的url进行统计并排序

[/tmp/test]# cat tt3
http:///index.html
http:///index.html
http:///index.html
http:///index.html
http:///index.html
http:///index.html
http:///index.html
[/tmp/test]# cat tt3 | cut -d "/" -f3 | sort | uniq -c | sort -nrk1
   3
   2
   1
   1

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24237320/viewspace-2061727/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-07-13

  • 博文量
    406
  • 访问量
    1208681