Python's simplicity philosophy

Bengt Richter bokr at oz.net
Sat Nov 22 14:25:21 EST 2003


On Thu, 20 Nov 2003 17:18:27 -0800, Erik Max Francis <max at alcyone.com> wrote:

>Ben Finney wrote:
>
>> Sadly, the 'NAME' section does:
>
>Yes, I quoted that earlier and commented on it.  It's not universal in
>uniq man pages.  The Solaris 8 man page, for instance, doesn't have this
>bug.
>
Just looked at the version that comes with msys:

----
[11:26] ~>uniq --help
Usage: uniq [OPTION]... [INPUT [OUTPUT]]
Discard all but one of successive identical lines from INPUT (or
standard input), writing to OUTPUT (or standard output).

  -c, --count           prefix lines by the number of occurrences
  -d, --repeated        only print duplicate lines
  -D, --all-repeated    print all duplicate lines
  -f, --skip-fields=N   avoid comparing the first N fields
  -i, --ignore-case     ignore differences in case when comparing
  -s, --skip-chars=N    avoid comparing the first N characters
  -u, --unique          only print unique lines
  -w, --check-chars=N   compare no more than N characters in lines
  -N                    same as -f N
  +N                    same as -s N
      --help            display this help and exit
      --version         output version information and exit

A field is a run of whitespace, then non-whitespace characters.
Fields are skipped before chars.

Report bugs to <bug-textutils at gnu.org>.
----

Where in the past have I seen an option for writing line repetions as a count message? I.e.,

hoo
hee
hee
haw
haw
haw
hoopla

becomes

hoo
hee
   *** above line repeated 1 more time ***
haw
   *** above line repeated 2 more times ***
hoopla

(Useful for collapsing error log content
such as a traceback from exceeding recursion depth ;-)

Whether to make a message for a single repeat or just allow two-in-row might be nice
to differentiate in e.g., a -g vs -G option.

Regards,
Bengt Richter




More information about the Python-list mailing list