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 #15 received at 18585 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: 18585 <at> debbugs.gnu.org, sebastian.schapovalov <at> telefonica.com
Subject: Re: bug#18585: Bad count in WC command?
Date: Mon, 29 Sep 2014 14:54:43 -0600
[Message part 1 (text/plain, inline)]
On 09/29/2014 02:47 PM, Eric Blake wrote:
> 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

Typo; I meant 'od' in both lines, not 'oc'.

> 
> 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 294 days ago.

Previous Next


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