Below awk
command removes all duplicate lines as explained here:
awk '!seen[$0]++'
If the text contains empty lines, all but one empty line will be deleted.
How can I keep all empty lines whilst deleting all non-empty duplicate lines, using only awk
?
Please, also include a brief explanation.
Best Answer
Another option is to check
NF
, eg: