From 5f06185b1b187993248b737c29dff9ded3996fa9 Mon Sep 17 00:00:00 2001 From: sin Date: Wed, 11 Feb 2015 12:12:21 +0000 Subject: [PATCH] uniq: Fixup program usage and manpage Remove -i as it is not required by POSIX. We'll add it if we hit scripts that require it. --- README | 2 +- uniq.1 | 29 ++++++++++++----------------- uniq.c | 4 +--- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/README b/README index 8325742..2b1c4a7 100644 --- a/README +++ b/README @@ -79,7 +79,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, =* tty yes none =* uname yes none #* unexpand yes none -= uniq no none += uniq no [infile [outfile]] =* unlink yes none = uudecode no -o = uuencode no -m diff --git a/uniq.1 b/uniq.1 index 433053f..08d190b 100644 --- a/uniq.1 +++ b/uniq.1 @@ -6,7 +6,10 @@ .Nd report or filter out repeated lines in a file .Sh SYNOPSIS .Nm -.Op Fl cdu +.Op Fl c +.Op Fl d | u +.Op Fl f Ar fields +.Op Fl s Ar chars .Op Ar file .Sh DESCRIPTION .Nm @@ -26,20 +29,12 @@ Prefixes each line with a count of its consecutive occurrences in the input. Suppresses non-duplicate lines (thus 'uniq -d' prints only duplicates). .It Fl u Suppresses non-unique lines (thus 'uniq -u' prints only uniques). +.It Fl f Ar fields +Ignore the first +.Ar fields +in each input line when doing comparisons. +.It Fl s Ar chars +Ignore the first +.Ar chars +characters in each input line when doing comparisons. .El -.Sh BUGS -The original sbase implementation of -.Nm -supported multiple input-file arguments as e.g. -.Xr cat 1 -and -.Xr grep 1 -do. -Unfortunately, POSIX uniq treats its second argument (if present) as an -output filename and clobbers it. Since users and scripts which rely on -.Nm -supporting multiple input-file arguments would be at risk of data loss -if they ever ran into a POSIX-compatible -.Nm -, support for multiple input-file arguments was removed from this -implementation. diff --git a/uniq.c b/uniq.c index 5791cc0..5b217e3 100644 --- a/uniq.c +++ b/uniq.c @@ -25,7 +25,7 @@ static long prevlinecount = 0; static void usage(void) { - eprintf("usage: %s [-cdiu] [input]]\n", argv0); + eprintf("usage: %s [-cdufs] [file]\n", argv0); } int @@ -34,8 +34,6 @@ main(int argc, char *argv[]) FILE *fp; ARGBEGIN { - case 'i': - eprintf("not implemented\n"); case 'c': countfmt = "%7ld "; break;