KeiruaProd

I help my clients acquire new users and make more money with their web businesses. I have ten years of experience with SaaS projects. If that’s something you need help with, we should get in touch!
< Back to article list

AWK: Removing duplicates in a file without sorting it

I found this one-liner today on commandlinefu.

Not something you do every day, and I’m not sure awk is worth investing into, but it’s quite handy anyway:

➜  ~ cat data.txt           
d
a
b
d
b
c
➜  ~ awk '!x[$0]++' data.txt
d
a
b
c