Reputation: 320
I have a list of urls that look like:
http://example.com/page1
http://example.com/page1
http://example.com/page1
http://example.com/page2
http://example.com/page2
http://example.com/page3
From this, I want to create a list that's like:
http://example.com/page1
http://example.com/page2
http://example.com/page3
So if there are more than one match, I want to return only one of the matches. What would the grep pattern be for that? Thanks.
Upvotes: 0
Views: 34
Reputation: 26667
You can very easily do it using awk
$ awk '!url[$0]++' input
http://example.com/page1
http://example.com/page2
http://example.com/page3
Upvotes: 1