GNU bug report logs -
#5832
Feature request: uniq -k
Previous Next
Full log
View this message in rfc822 format
Please excuse the cross-post but I have been told this is the
appropriate place to place a feature request.
Is it possible to make a feature request for uniq to add the "-k"
option to specify
fields? Interestingly uniq already has such things as
-f, --skip-fields=N
avoid comparing the first N fields
and
-s, --skip-chars=N
avoid comparing the first N characters
but no explicit option to specify which fields should be considered
when doing the comparison. This would be very useful, for example,
when removing duplicates from time series data (where you are only
worried about consecutive duplicates on certain fields). The awk
equivalent would be something like
awk '$2$3$4$5 != p; {p=$2$3$4$5}'
for using fields 2 to 5 as comparators.
Raphael
P.S. http://www.opengroup.org/onlinepubs/9699919799/utilities/uniq.html
is the posix specification for uniq if that is of any interest.
Curiously it says nothing about which duplicate line to keep when you
don't consider all fields in the comparison.
This bug report was last modified 13 years and 182 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.