Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!pacbell.com!att!att!cbnewsc!chapin From: chapin@cbnewsc.att.com ( Tom Chapin ) Newsgroups: comp.editors Subject: Re: Awk Keywords: If you don't like vi, then what about awk? :-) Message-ID: <1991Mar10.033934.13429@cbnewsc.att.com> Date: 10 Mar 91 03:39:34 GMT References: <17851@cgl.ucsf.EDU> Distribution: na Organization: Hickory Ridge - Lisle, IL Lines: 28 Darwin Alonso writes: >I have a question concerning what awk compares with the greater >and less than operators (><). It seems to compare floating point numbers >if the field is a number, but compares ASCII value (?) if the field >is not a number. >Is this intentional? Yes. Any expression can have both an ascii and a numerical value. If both sides of a comparison have numerical values, the comparison will be numeric, otherwise a string comparison will be made. This default behavior can be modified by coercing the values: VARIABLE + 0 will coerce the expression to number VARIABLE "" will coerce to string If an apparent string is coerced to numeric, its numeric value will be whatever number occurs before the first non-numeric character in the string. If none occur, the numeric value will be zero. >I couldn't find anything >on this in the awk book (Aho, Kernigan, Weiberger). Try pages 25-26 and pages 44-45. -- tom chapin att!hrccb!tjc tjc@hrccb.att.com