bug-textutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WC : Strange result...


From: Bob Proulx
Subject: Re: WC : Strange result...
Date: Fri, 12 Mar 2004 21:32:16 -0700
User-agent: Mutt/1.3.28i

Spaggiari, Jean-Marc wrote:
> wc is counting words "testing/moving" like only one word... Is it an
> issue?  Or a bug?  wc is counting words "it's" like only one word,
> but it's two... Is it an issue? Or a bug?

The original UNIX V7 manual documents 'wc' this way:

    A word is a maximal string of characters delimited by spaces, tabs
    or newlines.

Not breaking scripts which rely upon this behavior is very important.
The 'shar' program as one classic example has used 'wc' as an
inexpensive checksum-like of integrity check.  Changing the definition
can break a lot of existing scripts.

The single unix specification defines it this way:

    http://www.unix-systems.org/single_unix_specification_v2/xcu/wc.html

    The wc utility considers a word to be a non-zero-length string of
    characters delimited by white space.

It is not so much a "word" count as a "chunk of non-whitespace" count.
But close enough for counting words in text.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]