Hello,
I'm doing school project and I've found different behave of these two programs:
$ awk -W versionmawk 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 --vGNU 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