I find many ways to do this, AWK
, SED
, UNIQ
, but none of them are working on my file.
I want to delete duplicate lines. Here is an example of part of my file:
KTBX
KFSO
KCLK
KTBX
KFSO
KCLK
PAJZ
PAJZ
NOTE: I had to manually add line feeds when I cut and pasted from the file...for some reason it was putting all the variables on one line. Makes me think that my 44,000 line text file actually has only "1" line? Is there a way to modify it so I can delete dups?
Perl One-Liner:
perl -nle 'unless($hash{$_}++){print $_}' file
You can see all non-printed characters with this command:
If all your records are on one line, you can use sed to replace a whitespace (space, tab, newline) with a linebreak:
Once you have multiple lines, this awk one-liner:
my outfile: