bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] string misinterpretation


From: Love, Mr. Gary, Contractor, Code 7542
Subject: [bug-gawk] string misinterpretation
Date: Mon, 29 Apr 2013 15:20:37 -0700

Developers,

I encountered a problem when a value is extracted from a field using the substr 
function and is then used in a conditional numeric test.  The test fails unless 
I multiple the substr value by 1.0 because the parser thinks the value is a 
string.

The attached code and data file demonstrate the problem. The workaround for the 
problem is to change line 5 
From:
                         incrm=substr($0,191,14)
To:
                         incrm=1.0*substr($0,191,14)

Gary G. Love (SAIC)
Senior Scientist
Marine Meteorology Division
Naval Research Laboratory
Monterey, CA 93943
831-656-4767

Attachment: awk_if_test.dat
Description: awk_if_test.dat

Attachment: awk_if_test.ksh
Description: awk_if_test.ksh


reply via email to

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