emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#18585: closed (Bad count in WC command? )


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#18585: closed (Bad count in WC command? )
Date: Mon, 29 Sep 2014 20:48:03 +0000

Your message dated Mon, 29 Sep 2014 14:47:02 -0600
with message-id <address@hidden>
and subject line Re: bug#18585: Bad count in WC command?
has caused the debbugs.gnu.org bug report #18585,
regarding Bad count in WC command?  
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
18585: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18585
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Bad count in WC command? Date: Mon, 29 Sep 2014 13:25:40 +0000

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

 

sarasa () -- seba > echo "1029384756" | wc -c

11

 

sarasa () -- seba > echo 1029384756 | wc -m

11

 

sarasa () -- seba > echo "1029384756" | wc -m

11

 

I got the correct value only with the “–L” option.

 

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

10

 

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

10

 

I tested it (with same output) in:

 

Linux 2.6.9-78.0.22.ELlargesmp #1 SMP Fri Apr 24 12:59:13 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

and

Linux 3.2.0-29-generic-pae #46-Ubuntu SMP Fri Jul 27 17:25:43 UTC 2012 i686 i686 i386 GNU/Linux

 

 

Regards! (and excuse me for my bad english)

 

Seba




Este mensaje y sus adjuntos se dirigen exclusivamente a su destinatario, puede contener información privilegiada o confidencial y es para uso exclusivo de la persona o entidad de destino. Si no es usted. el destinatario indicado, queda notificado de que la lectura, utilización, divulgación y/o copia sin autorización puede estar prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción.

The information contained in this transmission is privileged and confidential information intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this transmission in error, do not read it. Please immediately reply to the sender that you have received this communication in error and then delete it.

Esta mensagem e seus anexos se dirigem exclusivamente ao seu destinatário, pode conter informação privilegiada ou confidencial e é para uso exclusivo da pessoa ou entidade de destino. Se não é vossa senhoria o destinatário indicado, fica notificado de que a leitura, utilização, divulgação e/ou cópia sem autorização pode estar proibida em virtude da legislação vigente. Se recebeu esta mensagem por erro, rogamos-lhe que nos o comunique imediatamente por esta mesma via e proceda a sua destruição

--- End Message ---
--- Begin Message --- Subject: Re: bug#18585: Bad count in WC command? Date: Mon, 29 Sep 2014 14:47:02 -0600 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1
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

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---

reply via email to

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