unix - remove first line if there is a duplicate -
i know how remove duplicate lines using sort
, uniq
there way remove first line duplicate not second?
for example, if have file following lines in it:
aaaaaaa bbbbbbb bbbbbbb ccccccc aaaaaaa ccccccc
the output needs be:
bbbbbbb aaaaaaa ccccccc
do need run loop of sort or can done uniq
? and, yes, know sorting backwards give me output that's not want.
thanks.
add sequential field beginning of each line using paste (1,2,3...), reverse list based on field, , run uniq ignoring field. sort field insure have remained in right order. remove field using cut or colrm.
Comments
Post a Comment