The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 12-13-2006
fredao fredao is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 59
how to remove duplicate lines

I have following file content (3 fields each line):

23 888 10.0.0.1
dfh 787 10.0.0.2
dssf dgfas 10.0.0.3
dsgas dg 10.0.0.4
df dasa 10.0.0.5
df dag 10.0.0.5
dfd dfdas 10.0.0.5
dfd dfd 10.0.0.6
daf nfd 10.0.0.6
...

as can be seen, that the third field is ip address and sorted. but there is duplilcate ip addresses. I want to kill line 6,7 and 9, so the new file will be

23 888 10.0.0.1
dfh 787 10.0.0.2
dssf dgfas 10.0.0.3
dsgas dg 10.0.0.4
df dasa 10.0.0.5
dfd dfd 10.0.0.6
...

please tell me how to do this, thanks!