AWK: Remove duplicated lines in

2018-03-20  本文已影响0人  cutelittlePanda

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

上一篇 下一篇

猜你喜欢

热点阅读