bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] [BUG] Diffent outputs from gawk and mawk


From: Jozef Zuzelka
Subject: [bug-gawk] [BUG] Diffent outputs from gawk and mawk
Date: Mon, 27 Apr 2015 20:23:37 +0200

Hello,
I'm doing school project and I've found different behave of these two programs:

$ awk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
compiled limits:
max NF             32767
sprintf buffer      2040

$ echo "02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020***************************" | awk 'length > 127 {print substr ($0, 0, 127)"\t"$2} length < 128 {print $1"\t"$2}' | tail -1 | wc -c
OUTPUT is 128


$ awk --v
GNU Awk 3.1.7
Copyright (C) 1989, 1991-2009 Free Software Foundation.

$ echo "02020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020***************************" | awk 'length > 127 {print substr ($0, 0, 127)"\t"$2} length < 128 {print $1"\t"$2}' | tail -1 | wc -c
OUTPUT is 129

-----------------------------------------------
I think that mawk is the one with correct output, but I may be wrong. I attached you printscreen witch outputs.

P.S.: Sorry for my bad English :)

I'm looking forward for your reply.
--
Best regards,
Jozef Zuzelka

Attachment: tmp.jpg
Description: JPEG image


reply via email to

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