Hossain, Syed wrote:
> I am surprised that I could not found any posting related to this,

Here is a recent one.  :-)

  http://lists.gnu.org/archive/html/bug-coreutils/2008-04/msg00238.html

> /home/shossain$ echo 1234 | wc -m
> 5
> Obviously I was expecting a count of 4 but wc printed out 5. I have
> tried different string and the count is always increased by one.

The newline on the end of the line is a character.  You can see this
by using od to dump the values.

  echo 1234 | od -tx1 -c
  0000000 31 32 33 34 0a
            1   2   3   4  \n

Of course wc is behaving correctly here.

Bob


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to