Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formating file contents

Status
Not open for further replies.

unmlobo

MIS
Apr 11, 2003
64
US
I have a file that has data in the format below. Is there a way for me to have the system see that user2 is the same as the other user2 and delete one of them. I'm trying to weed out dups. I think this would be a sed or awk script which I'm not familar with. Thanks all!

user1 pts/23 Jan 29 14:24 (1.1.1.1)
user2 pts/23 Jan 29 08:52 (2.2.2.2)
user2 pts/23 Jan 29 08:52 (2.2.2.2)
user3 pts/20 Jan 29 13:08 (3.3.3.3)
user3 pts/20 Jan 29 13:08 (3.3.3.3)
user4 pts/34 Jan 29 13:39 (4.4.4.4)
user4 pts/34 Jan 29 13:39 (4.4.4.4)
user5 pts/4 Jan 29 09:57 (5.5.5.5)
user5 pts/4 Jan 29 09:57 (5.5.5.5)
 
Code:
sort -u file > newfile
would remove identical entries from a file.

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top