this is a line this is a line this is another line this is a line this is yet another line this is yet another line
是否有可能在命令行上打印出每个唯一的行,但按其出现的频率sorting。
即以前的文本的结果将是:
this is a line this is yet another line this is another line
它们分别出现3次,2次和1次。
awk脚本总是打印sum = 0
从几个文件中计数重复
在awk中只打印一些列
使用awk进行编辑
如何使用unix命令在文本文件中find列号
如何在bash脚本中使用awk过滤两个date之间的数据
如何replace文件中的string基于来自另一个文件的值? (里面的例子)
awk / sed / grep删除与其他文件中的字段匹配的字段
脚本,UNIX,比较
关于linux中的awk shell和pipe
试试这个:
sort file|uniq -c|sort -rn
编辑:此外,如果你想删除计数器在行的开头只是管sed 's/^s*[0-9]* (.*)$/1/'在上述命令。
你可以这样做:
awk '{ a[$0]++ } END {for (i in a) print a[i],i }' | sort -nr 3 this is a line 2 this is yet another line 1 this is another line
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。