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
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
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
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 000 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