Joe
Joe

Reputation: 61

Merging identical lines in an output

I'm trying to merge or not repeat the lines in an output using bash but don't want to grep for it. I'm not sure how to do it. I'm trying to do this in Linux:

Before:

113.171.10.13
113.171.10.13
113.171.10.13
113.171.10.13
23.253.228.76
23.253.228.76
23.253.228.76
23.253.228.76
23.253.228.76
23.253.228.76

After:

113.171.10.13
23.253.228.76

Any help is appreciated!

Thanks!

Upvotes: 3

Views: 1069

Answers (1)

rodrigomelo
rodrigomelo

Reputation: 69

Use unique sort, outputing only the first of an equal run:

sort -u

Upvotes: 2

Related Questions