Reputation:
My questions is fairly simple. I have a file containing lines which are often duplicates of one another. My first attempt used awk: cat /tmp/log |awk '!x[$0]++'|
.
That does the job perfectly except that I realized there was one line that I need to have duplicated.
So basically I need to remove all duplicates except for one that contains "Successful association". Even if it is a dupe.
Any ideas are welcome!
Upvotes: 1
Views: 84
Reputation: 97968
Print the line if not seen before or it equals to the allowed duplicate:
awk '!x[$0]++ || ($0 ~ /Successful association/)' /tmp/log
Upvotes: 2