fix uniq -c
fix uniq -c
Posted Feb 12, 2025 19:06 UTC (Wed) by NYKevin (subscriber, #129325)In reply to: fix uniq -c by stijn
Parent article: Rewriting essential Linux packages in Rust
> A field is the maximal string matched by the basic regular expression:
> [[:blank:]]*[^[:blank:]]*
But note that this is describing how the -f flag works, not the -c flag (which is also the case for the man page you quote).
As far as I can tell, POSIX makes no allowance whatsoever for right-justifying the -c output, and in fact specifies the opposite:
> If the -c option is specified, the output file shall be empty or each line shall be of the form:
> "%d %s", <number of duplicates>, <line>
(%d means "a number in decimal," not "a number in decimal, but possibly with some whitespace in front of it.")
If a uniq implementation right-justifies its -c output, that is either a bug or a deliberate non-conformance to the standard. I would suggest reporting it upstream if you have not already done so.
[1]: https://pubs.opengroup.org/onlinepubs/9799919799/utilitie...
