Hey guys, need some help to fix this script. I am trying to remove all the duplicate lines in this file.
I wrote the following script, but does not work. What is the problem?
The output file should only contain five lines:
Later!
Hey guys, need some help to fix this script. I am trying to remove all the duplicate lines in this file.
I wrote the following script, but does not work. What is the problem?
The output file should only contain five lines:
Later!
You are close.
Try using
sort -u
It works great! Many thanks!
In awk: remove duplicate, nonconsecutive lines
awk '!($0 in a) {a[$0];print}' inputfile.txt
awk '!a[$0]++' infile
perl -ne '$s{$_}++||print' infile