From bc70de7b3302d5a81515b901cae376b8b51d2004 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 16 Jul 2010 13:09:56 +0300 Subject: Move to gawk-3.1.0. --- test/ofmt.awk | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 test/ofmt.awk (limited to 'test/ofmt.awk') diff --git a/test/ofmt.awk b/test/ofmt.awk new file mode 100644 index 00000000..a7b63d63 --- /dev/null +++ b/test/ofmt.awk @@ -0,0 +1,53 @@ +# From dragon!knorke.saar.de!florian Wed Jul 16 10:47:27 1997 +# Return-Path: +# Message-ID: <19970716164451.63610@knorke.saar.de> +# Date: Wed, 16 Jul 1997 16:44:51 +0200 +# From: Florian La Roche +# To: bug-gnu-utils@prep.ai.mit.edu +# CC: arnold@gnu.ai.mit.edu +# Subject: bug in gawk 3.0.3 +# MIME-Version: 1.0 +# Content-Type: text/plain; charset=us-ascii +# X-Mailer: Mutt 0.76 +# Status: R +# Content-Length: 1725 +# X-Lines: 177 +# X-Display-Position: 0 +# +# I have a problem with gawk 3.0.3 on linux with libc 5.4.33. +# The memory is corrupted, if I use OFMT = "%.12g". +# With OFMT = "%.6g" evrything works fine, but I don't have enough +# digits for the computation. +# +# Thanks a lot, +# Florian La Roche +# +# Here is the sample awk-Script together with sample data: +# +BEGIN { + OFMT = "%.12g" + big = 99999999999 + lowest = big + small = 0 + highest = small + dir = "" + } +$0 ~ /^[0-9]+$/ { + # some old awks do not think $0 is numeric, so use $1 + if ($1 < lowest) + lowest = $1 + if ($1 > highest) + highest = $1 + next +} +$0 ~ /\/\.:$/ { + if (dir != "") { + if (highest != small) + print dir, highest, lowest + else + print dir, "-", "-" + } + dir = substr($0, 1, length($0)-3) # trim off /.: + lowest = big + highest = small +} -- cgit v1.2.3