中的所有唯一行而不对行进行排序?我想基本上这样做: sort -u myFile 没有排序的性能. 删除重复的行: awk '!a[$0]++' file 这是着名的awk单行.对inet有很多解释. Here是一个解释: This one-liner is very idiomatic. It registers the lines seen in the as
有没有办法通过命令行工具过滤掉文件中的所有唯一行而不对行进行排序?我想基本上这样做:
sort -u myfile
没有排序的性能.
解决方法 删除重复的行:
awk '!a[]++' file
这是着名的awk单行.对inet有很多解释. Here是一个解释:
This one-liner is very idiomatic. It registers the lines seen in the associative-array “a” (arrays are always associative in Awk) and at the same time tests if it had seen the line before. If it had seen the line before,then a[line] > 0 and !a[line] == 0. Any Expression that evaluates to false is a no-op,and any Expression that evals to true is equal to “{ print }”.
评论列表(0条)