This patch (against current coreutils anon-CVS) implements a -z option
to uniq.
It is like sort's -z option. It has the same long form,
--zero-terminated, as the -z option to sort. The implementation
relies on the linebuffer module offering readlinebuffer_delim. I
submitted an implementation for that function to bug-gnulib this
morning.
To avoid potential problems with whitespace change, I have attached
the patch to this email rather than pasting it in. I also include the
text of the relevant ChangeLog entry inline.
Thanks,
James.
2007-05-12 James Youngman <address@hidden>
Add -z option to uniq. This was originally proposed by
Egmont Koblinger.
* NEWS: Mention that uniq has gained a new option,
--zero-terminated (-z).
* src/uniq.c (longopts, check_file, main): Added new option
--zero-terminated (-z). This makes uniq consume and produce
NUL-terminated lines rather than newline-terminated lines, which
is the default. Pass the delimiter as a function argument from
main into check_file.
* doc/uniq.texi (uniq invocation): Describe the new option
--zero-terminated (-z).
* tests/uniq/Test.pm (@tv): add a number of new tests for the uniq
option -z (and its synonym, --zero-terminated).
* tests/uniq/Makefile.am (run_gen, maint_gen): add the new test
files generated by the updated Test.pm file.