GNU bug report logs - #18585
Bad count in WC command?

Previous Next

Package: coreutils;

Reported by: "Schapovalov, Sebastian" <sebastian.schapovalov <at> telefonica.com>

Date: Mon, 29 Sep 2014 20:36:02 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


Message #7 received at control <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: "Schapovalov, Sebastian" <sebastian.schapovalov <at> telefonica.com>,
 18585-done <at> debbugs.gnu.org
Subject: Re: bug#18585: Bad count in WC command?
Date: Mon, 29 Sep 2014 14:47:02 -0600
[Message part 1 (text/plain, inline)]
tag 18585 notabug
thanks

On 09/29/2014 07:25 AM, Schapovalov, Sebastian wrote:
> Hello, I was testing one parameter in my .sh and realised that the wc command return a different value that I was expected.  I send you a couple examples.
> 
> I have to validate a celular telephone number (in Argentina), so, it has to be a 10 chars parameter.
> 
> sarasa() -- seba > echo 1029384756 | wc -c
> 11

Classic user mistake.  'echo' outputs a trailing newline, which IS a
character,

> sarasa () -- seba > echo 1029384756 | wc -L
> 10

but does NOT contribute to the length of the longest line.  Try
comparing these two commands

echo 1029384756 | oc -tx1z
printf 1029384756 | oc -tx1z

to see what I mean.

I'm closing this as not a bug, but feel free to ask further questions.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 10 years and 293 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.