GNU bug report logs -
#18585
Bad count in WC command?
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18585 in the body.
You can then email your comments to 18585 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#18585
; Package
coreutils
.
(Mon, 29 Sep 2014 20:36:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Schapovalov, Sebastian" <sebastian.schapovalov <at> telefonica.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Mon, 29 Sep 2014 20:36:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/html, inline)]
Added tag(s) notabug.
Request was from
Eric Blake <eblake <at> redhat.com>
to
control <at> debbugs.gnu.org
.
(Mon, 29 Sep 2014 20:48:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Eric Blake <eblake <at> redhat.com>
:
You have taken responsibility.
(Mon, 29 Sep 2014 20:48:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
"Schapovalov, Sebastian" <sebastian.schapovalov <at> telefonica.com>
:
bug acknowledged by developer.
(Mon, 29 Sep 2014 20:48:04 GMT)
Full text and
rfc822 format available.
Message #12 received at 18585-done <at> debbugs.gnu.org (full text, mbox):
[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)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#18585
; Package
coreutils
.
(Mon, 29 Sep 2014 20:55:02 GMT)
Full text and
rfc822 format available.
Message #15 received at 18585 <at> debbugs.gnu.org (full text, mbox):
[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)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 28 Oct 2014 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 292 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.