Cross-reference head -n 1 -g from uniq for keep-all-columns dedupe (#1075) (#2158)

The uniq verb outputs only the group-by columns, and issue #1075 asks
for a way to deduplicate on some fields while keeping the rest. Miller
already supports this via "head -n 1 -g", but that wasn't discoverable
from uniq's help text or its reference-verbs section. Add a note to
"mlr uniq --help" and a short recipe (with live examples) to the uniq
section of the verbs reference, and regenerate the derived man page,
docs, and CLI-help golden files.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
John Kerl 2026-07-06 15:26:39 -04:00 committed by GitHub
parent a707a155f2
commit a63ea57359
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 92 additions and 0 deletions

View file

@ -169,6 +169,9 @@ func transformerUniqUsage(
fmt.Fprintf(o, "count-distinct. For uniq, -f is a synonym for -g. Output fields are\n")
fmt.Fprintf(o, "written in the order in which they are named with -g or -f, not in the\n")
fmt.Fprintf(o, "order in which they appear in the input records.\n")
fmt.Fprintf(o, "To deduplicate records by one or more fields while keeping all other\n")
fmt.Fprintf(o, "fields, use head: e.g. \"%s head -n 1 -g hash\" keeps the first record\n", argv0)
fmt.Fprintf(o, "for each distinct value of the hash field, with all fields intact.\n")
fmt.Fprintf(o, "\n")
WriteVerbOptions(o, uniqOptions)
}