1*e6d6c189SCody Peter Mello# From dragon!knorke.saar.de!florian Wed Jul 16 10:47:27 1997 2*e6d6c189SCody Peter Mello# Return-Path: <dragon!knorke.saar.de!florian> 3*e6d6c189SCody Peter Mello# Message-ID: <19970716164451.63610@knorke.saar.de> 4*e6d6c189SCody Peter Mello# Date: Wed, 16 Jul 1997 16:44:51 +0200 5*e6d6c189SCody Peter Mello# From: Florian La Roche <florian@knorke.saar.de> 6*e6d6c189SCody Peter Mello# To: bug-gnu-utils@prep.ai.mit.edu 7*e6d6c189SCody Peter Mello# CC: arnold@gnu.ai.mit.edu 8*e6d6c189SCody Peter Mello# Subject: bug in gawk 3.0.3 9*e6d6c189SCody Peter Mello# MIME-Version: 1.0 10*e6d6c189SCody Peter Mello# Content-Type: text/plain; charset=us-ascii 11*e6d6c189SCody Peter Mello# X-Mailer: Mutt 0.76 12*e6d6c189SCody Peter Mello# Status: R 13*e6d6c189SCody Peter Mello# Content-Length: 1725 14*e6d6c189SCody Peter Mello# X-Lines: 177 15*e6d6c189SCody Peter Mello# X-Display-Position: 0 16*e6d6c189SCody Peter Mello# 17*e6d6c189SCody Peter Mello# I have a problem with gawk 3.0.3 on linux with libc 5.4.33. 18*e6d6c189SCody Peter Mello# The memory is corrupted, if I use OFMT = "%.12g". 19*e6d6c189SCody Peter Mello# With OFMT = "%.6g" evrything works fine, but I don't have enough 20*e6d6c189SCody Peter Mello# digits for the computation. 21*e6d6c189SCody Peter Mello# 22*e6d6c189SCody Peter Mello# Thanks a lot, 23*e6d6c189SCody Peter Mello# Florian La Roche 24*e6d6c189SCody Peter Mello# 25*e6d6c189SCody Peter Mello# Here is the sample awk-Script together with sample data: 26*e6d6c189SCody Peter Mello# 27*e6d6c189SCody Peter MelloBEGIN { 28*e6d6c189SCody Peter Mello OFMT = "%.12g" 29*e6d6c189SCody Peter Mello big = 99999999999 30*e6d6c189SCody Peter Mello lowest = big 31*e6d6c189SCody Peter Mello small = 0 32*e6d6c189SCody Peter Mello highest = small 33*e6d6c189SCody Peter Mello dir = "" 34*e6d6c189SCody Peter Mello } 35*e6d6c189SCody Peter Mello$0 ~ /^[0-9]+$/ { 36*e6d6c189SCody Peter Mello # some old awks do not think $0 is numeric, so use $1 37*e6d6c189SCody Peter Mello if ($1 < lowest) 38*e6d6c189SCody Peter Mello lowest = $1 39*e6d6c189SCody Peter Mello if ($1 > highest) 40*e6d6c189SCody Peter Mello highest = $1 41*e6d6c189SCody Peter Mello next 42*e6d6c189SCody Peter Mello} 43*e6d6c189SCody Peter Mello$0 ~ /\/\.:$/ { 44*e6d6c189SCody Peter Mello if (dir != "") { 45*e6d6c189SCody Peter Mello if (highest != small) 46*e6d6c189SCody Peter Mello print dir, highest, lowest 47*e6d6c189SCody Peter Mello else 48*e6d6c189SCody Peter Mello print dir, "-", "-" 49*e6d6c189SCody Peter Mello } 50*e6d6c189SCody Peter Mello dir = substr($0, 1, length($0)-3) # trim off /.: 51*e6d6c189SCody Peter Mello lowest = big 52*e6d6c189SCody Peter Mello highest = small 53*e6d6c189SCody Peter Mello} 54