Commit graph

30 commits

Author SHA1 Message Date
Dag-Erling Smørgrav 11715600e6 uniq: Fix interactive use.
Output a line as soon as it is possible to determine that it will have
to be output.  For the basic case, this means output each line as it is
read unless it is identical to the previous one.  For the -d case, it
means output the first instance as soon as the second is read, unless
the -c option was also given.  The -D and -u cases were already fine.

Add test cases for interactive use with no options and with -d.

Explicitly ignore -d when -D is also specified.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	rew, kevans
Differential Revision:	https://reviews.freebsd.org/D43382
2024-01-12 16:43:55 +01:00
Warner Losh bdcbfde31e usr.bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:30 -07:00
Warner Losh b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Benedict Reuschling e6e3cf55d3 Add EXAMPLES to cover all flags except -f since it is analogous to -s.
An EXAMPLE section was adding with some basic examples that show the use of
uniq(1) with various flags.

Submitted by:	fernape@
Approved by:	bcr@
MFC after:	4 days
Relnotes:	yes (EXAMPLE section for uniq(1))
Differential Revision:	https://reviews.freebsd.org/D25149
2020-06-07 13:21:47 +00:00
Ian Lepore d937171727 Support --all-repeats in uniq(1) for compatibility with gnu coreutils.
This adds a new -D/--all-repeats option to uniq(1), which outputs each copy
of any repeated lines (as opposed to a single copy of a repeated line). You
can specify a separator option to output a blank line before or after each
group of repeated lines. This adds compatibility with the GNU coreutils
version of uniq(1).

This change also re-groups the -c, -d, -D, -u options in the usage display
and man page to indicate that they are mutally exclusive of each other. This
matches the posix/opengroup definition of uniq(1) command line args. Note
that this change does NOT actually enforce the mutual exclusion in the code,
for now, it simply documents that the arguments should be considered
exclusive with each other.

Differential Revision:	https://reviews.freebsd.org/D22262
2019-12-15 18:05:18 +00:00
Kyle Evans a597327b90 uniq(1): Add some long options
These match GNU uniq(1) where appropriate for compatibility's sake.

While here, re-sort options alphabetically by the short-option.

MFC after:	1 month
2018-05-02 01:17:08 +00:00
Ed Maste a520574d76 uniq: allow -c to be used with -d or -u
Bring in some bits from NetBSD and lift the restriction in uniq(1) that
-c cannot be used with the -d and -u options.  This restriction seems
unnecessary and is supported at least by GNU, OpenBSD, and NetBSD.  Lift
the restriction and simplify the show() logic a little bit to maintain
functionality when -c is provided with -d/-u.

Also with this change, -d and -u are now actually a mutually exclusive,
albeit valid, combination.  Given that they both indicate opposite
behavior, uniq(1) will no longer output anything if both -d and -u are
supplied.  This is in line with NetBSD as well as GNU.

Adjust the man page and usage() to reflect that -c is its own standalone
option.

PR:		200553
Submitted by:	Kyle Evans <kevans91@ksu.edu>
Reviewed by:	cem, emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D10694
2017-05-15 20:18:14 +00:00
Warner Losh fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Joel Dahl da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Jaakko Heinonen 698f926389 The input line length limit mentioned on the manual page was removed by
r176119.

Approved by:	trasz (mentor)
2009-12-17 16:59:19 +00:00
Giorgos Keramidas 1833a7eaee Document that uniq(1) limits input line length to LINE_MAX characters.
PR:		docs/107578
Submitted by:	Jan Schaumann, jschauma.at.netmeister.org
MFC after:	3 days
2007-01-15 23:25:51 +00:00
Ruslan Ermilov a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Tim J. Robbins 3fead394ea Add support for multibyte characters. 2004-07-02 23:43:05 +00:00
Ruslan Ermilov 6a3e8b0adc Mechanically kill hard sentence breaks. 2004-07-02 22:22:35 +00:00
Tim J. Robbins e90e39d92f Document the fact that uniq(1) does not recognize multibyte characters. 2004-06-24 16:29:28 +00:00
Tim J. Robbins 058d268671 Mention the environment variables that affect the execution of uniq.
Of particular interest is the fact that LC_COLLATE affects how uniq
determines whether lines are equal. This was the subject of a fairly heated
debate a year or so ago, and it turns out that the current behaviour is
correct and that the standard contained an error.

Now that the standard has been corrected by Cor. 1-2002, refer to 1003.1-2001
instead of the 1992 edition in the Standards section.
2003-04-12 04:17:14 +00:00
Ruslan Ermilov 06e482e60a mdoc(7) police: markup polishing.
Approved by:	re
2002-11-26 17:33:37 +00:00
Tim J. Robbins fa745288a7 Correct the History section; uniq(1) appeared at least as early as V3.
Move the section to after Standards.
2002-07-05 09:44:47 +00:00
Tim J. Robbins 898e5fd3f3 Remove redundant description of input_file and output_file arguments. 2002-07-05 09:37:34 +00:00
Juli Mallett 6fc8ba94c6 Note that this appeared at least as early as PWB UNIX.
Use the literal string 'PWB UNIX', as we still have no .At macro for it.
2002-06-10 22:59:59 +00:00
Tim J. Robbins 38b1ff46af Accept an input file name of "-" to mean standard input, as required by
P1003.2.
2002-05-30 00:07:14 +00:00
Tom Rhodes e223a77118 Add the word ``fields'' to the description, and change an instance from
fields to num in the SYNOPSIS

Noticed by:	keramida
2002-05-24 19:12:02 +00:00
Tom Rhodes 69cc776cd6 Reword a small part of the uniq(1) manual page to help reduce word
duplication (ie: fields fields).

PR:		38161
Reviewed by:	keramida
MFC after:	3 days
2002-05-21 16:54:58 +00:00
Ruslan Ermilov d628d776c4 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
Philippe Charnier dbb9d8f826 Add DIAGNOSTICS section name 2000-03-26 15:06:46 +00:00
Peter Wemm c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Bill Fumerola faaf9d7f46 Grammar nits, double negatives
PR:		docs/10491
Submitted By:	Tom Hukins <tom@eborcom.com>
1999-03-15 02:57:29 +00:00
Joerg Wunsch 2ca7dc1598 Teach comm(1) and uniq(1) about an option for case-insensitive work.
PR:		3042
Submitted by:	graphix@iastate.edu (Kent Vander Velden)
1997-09-07 15:09:22 +00:00
Philippe Charnier 213915d456 Use err(3) instead of local redefinition. 1997-08-21 06:51:10 +00:00
Rodney W. Grimes 9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00