How to delete duplicate lines in file in unix?

awk, sed, unix

Solution

There's a "famous" awk idiom:

awk '!seen[$0]++' file

It has to keep the unique lines in memory, but it preserves the file order.

Problem

I can delete duplicate lines in files using below commands: 1) sort -u and uniq commands. is that possible using sed or awk ?

Original source

Related problems