This is mainly for my own reference, however you may find it useful as well.
Remove duplicate entries in a file without sorting.
$ awk '!x[$0]++' FILE where FILE is the name of the file to run on.
One can also use sort | uniq or sort -u however this will sort the files into an order.
With awk we are simply removing all the duplicates.
Remove duplicate entries in a file without sorting.
$ awk '!x[$0]++' FILE where FILE is the name of the file to run on.
One can also use sort | uniq or sort -u however this will sort the files into an order.
With awk we are simply removing all the duplicates.
No comments:
Post a Comment