PDA

View Full Version : matching lines awk, giving me trouble



Drenriza
November 9th, 2011, 01:44 PM
Hi all.

I have a file which is as below

5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
4 0.1.9-0.5.1
5 2.1.4-1.0.0
5 2.1.5-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0

What i want to do is get awk tell me on a few lines, the lines who is different from the others.
So i get output with unique and non-duplicated lines.

Example.
The above gets to be
4 0.1.9-0.5.1
5 2.1.4-1.0.0
5 2.1.5-1.0.0

And all the other lines get discarded.
Hope it makes sense.

Kind regards.

Arndt
November 9th, 2011, 02:05 PM
Hi all.

I have a file which is as below

5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0
4 0.1.9-0.5.1
5 2.1.4-1.0.0
5 2.1.5-1.0.0
5 2.1.4-1.0.0
5 2.1.4-1.0.0

What i want to do is get awk tell me on a few lines, the lines who is different from the others.
So i get output with unique and non-duplicated lines.

Example.
The above gets to be
4 0.1.9-0.5.1
5 2.1.4-1.0.0
5 2.1.5-1.0.0

And all the other lines get discarded.
Hope it makes sense.

Kind regards.

sort -u

Drenriza
November 9th, 2011, 02:30 PM
Now when i see your solution i see that the solution was staring me in the face the entire time :p
Earlier in my script i have an sort -n |uniq to do the same thing just to some other information :D

Thanks for triggering my mind.

Kind regards