bug-coreutils
[Top][All Lists]
Advanced

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

wc -m count is wrong


From: Hossain, Syed
Subject: wc -m count is wrong
Date: Thu, 3 Jul 2008 11:35:54 -0400

Hi gurus,

 

I am surprised that I could not found any posting related to this, I was
doing simple character count and here is the output from wc:

 

/home/shossain$ echo 1234 | wc -m

5

/home/shossain$

 

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. I also
did a test using file:

 

/home/shossain$ echo "0123456789" > test.wc

/home/shossain$ cat test.wc

0123456789

/home/shossain$ cat test.wc | wc -m

11

/home/shossain$

 

Count should have 10 in this case but wc printed 11!!!!

 

Here is the wc version information:

/home/shossain$ which wc

/usr/bin/wc

/home/shossain$ ls -l /usr/bin/wc

-rwxr-xr-x  1 root root 21860 Jun 20  2005 /usr/bin/wc

/home/shossain$ wc --version

wc (coreutils) 5.2.1

Written by Paul Rubin and David MacKenzie.

 

Copyright (C) 2004 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is
NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

/home/shossain$

 

 

Here is the Linux kernel information:

/home/shossain$ uname -a

Linux XXXXX.neustar.com 2.6.9-22.ELsmp #1 SMP Mon Sep 19 18:32:14 EDT
2005 i686 i686 i386 GNU/Linux

 

Please let me know if any other information I need to provide for this
bug. Thanks.

 

Syed



reply via email to

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