Date: Thu, 11 Jun 2020 10:00:56 +0000 (UTC) From: Benedict Reuschling <bcr@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r362046 - stable/12/usr.bin/uniq Message-ID: <202006111000.05BA0uTR043471@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bcr (doc committer) Date: Thu Jun 11 10:00:56 2020 New Revision: 362046 URL: https://svnweb.freebsd.org/changeset/base/362046 Log: MFC r361891: 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@ Relnotes: yes (EXAMPLE section for uniq(1)) Differential Revision: https://reviews.freebsd.org/D25149 Modified: stable/12/usr.bin/uniq/uniq.1 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/uniq/uniq.1 ============================================================================== --- stable/12/usr.bin/uniq/uniq.1 Thu Jun 11 09:41:54 2020 (r362045) +++ stable/12/usr.bin/uniq/uniq.1 Thu Jun 11 10:00:56 2020 (r362046) @@ -31,7 +31,7 @@ .\" From: @(#)uniq.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd December 15, 2019 +.Dd June 7, 2020 .Dt UNIQ 1 .Os .Sh NAME @@ -147,6 +147,56 @@ as described in .Xr environ 7 . .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Assuming a file named cities.txt with the following content: +.Bd -literal -offset indent +Madrid +Lisbon +Madrid +.Ed +.Pp +The following command reports three different lines since identical elements +are not adjacent: +.Bd -literal -offset indent +$ uniq -u cities.txt +Madrid +Lisbon +Madrid +.Ed +.Pp +Sort the file and count the number of identical lines: +.Bd -literal -offset indent +$ sort cities.txt | uniq -c + 1 Lisbon + 2 Madrid +.Ed +.Pp +Assuming the following content for the file cities.txt: +.Bd -literal -offset indent +madrid +Madrid +Lisbon +.Ed +.Pp +Show repeated lines ignoring case sensitiveness: +.Bd -literal -offset indent +$ uniq -d -i cities.txt +madrid +.Ed +.Pp +Same as above but showing the whole group of repeated lines: +.Bd -literal -offset indent +$ uniq -D -i cities.txt +madrid +Madrid +.Ed +.Pp +Report the number of identical lines ignoring the first character of every line: +.Bd -literal -offset indent +$ uniq -s 1 -c cities.txt + 2 madrid + 1 Lisbon +.Ed .Sh COMPATIBILITY The historic .Cm \&\(pl Ns Ar number
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006111000.05BA0uTR043471>