How can I delete duplicate lines in a text file via command prompt?
For Example:
I have a 10MB text file and I want to keep only one line of My line
, but somewhere in the text file there are 2 My line
s.
command linetext processing
How can I delete duplicate lines in a text file via command prompt?
For Example:
I have a 10MB text file and I want to keep only one line of My line
, but somewhere in the text file there are 2 My line
s.
Best Answer
Using awk
the way it works is that it keeps count of the lines in an array, and if the current count is zero, ie the first occurance, it prints the line, otherwise it continues to the next one.