I want to remove duplicate words/strings from a large tab separated file using Linux commands.
names john, cnn, mac, tommy, mac, patrick, ngc, discovery, john, cnn, adam, patrick
cities san jose, santa clara, san franscisco, new york, san jose, santa clara
The above is the file format, I want to retain the tabs and commas after removing the duplicate words.
names john, cnn, mac, tommy, patrick, ngc, discovery, adam
cities san jose, santa clara, san franscisco, new york
Any help would be appreciated.
If you’re not using GNU AWK (
gawk) then you can’tdeletethe array, usesplit("", array)instead.