RE: wc -m count is wrong
Andreas, My point is new line is a non printable character and if I do not remember all the stuff like echo does prints a new line character, I will be mislead. Anyway, it is an ideological discussion how to interpret it but I thank you and the GNU team for prompt response and being at top of the issues. Syed -Original Message- From: Andreas Schwab [mailto:[EMAIL PROTECTED] Sent: Friday, July 04, 2008 5:50 AM To: Hossain, Syed Cc: Bob Proulx; bug-coreutils@gnu.org Subject: Re: wc -m count is wrong Hossain, Syed [EMAIL PROTECTED] writes: I can understand now why wc increasing it by one It does not do that. It just does not ignore any character. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 And now for something completely different. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
RE: wc -m count is wrong
James, First, I thank you and the GNU team for being prompt and for being at the top of the issues. Second new line is a non printable character and users will not always remember that. By reading the description I thought new line counts are printed separately not included in character counts (probably it is my limitation of understanding or probably I was focused on option description so, misinterpreted it). Anyway, my interpretation would be something like bellow: -m, --chars print the character counts (note: counts will also includes not printable charaters) or add examples that I saw in the one of the GNU posting i.e. echo 1234 | wc -m prints 5 echo -n 1234 | wc -m prints 4 Thanks again, Syed -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of James Youngman Sent: Friday, July 04, 2008 3:38 AM To: Hossain, Syed Cc: Bob Proulx; bug-coreutils@gnu.org Subject: Re: wc -m count is wrong On Thu, Jul 3, 2008 at 8:27 PM, Hossain, Syed [EMAIL PROTECTED] wrote: Bob Thanks for getting back to me promptly. I can understand now why wc increasing it by one but it is obviously, the explanation you gave me should be documented in man page or info page, agreed? Thanks. How should we change the wc manual page, then?Currently it says: NAME wc - print newline, word, and byte counts for each file SYNOPSIS wc [OPTION]... [FILE]... wc [OPTION]... --files0-from=F DESCRIPTION Print newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified. With no FILE, or when FILE is -, read standard input. -c, --bytes print the byte counts Personally, I find this quite clear; newlines are bytes too. But, what change do you propose? James. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
wc -m count is wrong
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 X.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 ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils