美文网首页
AWK: Remove duplicated lines in

AWK: Remove duplicated lines in

作者: cutelittlePanda | 来源:发表于2018-03-20 11:05 被阅读0次

1). !($0 in array) : if the entire line Not in the array, then;

2). {array[$0]; print}  :  put the entire line into the array as a element, then print it out, meanwhile;

3). {cnt++; print cnt}  :  count the new line numbers, then print out the count num.

======In short, the same as: >

a).  !a[$0]:  if a[$0] not already exists in the array a[], print it out, then;

b).  (!a[$0])++  :    move to next line

相关文章

网友评论

      本文标题:AWK: Remove duplicated lines in

      本文链接:https://www.haomeiwen.com/subject/ebspqftx.html