最佳答案
删除重复的行:
原文链接:https://www.f2er.com/linux/440625.htmlawk '!a[$0]++' 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 }”.