Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ogicse!usenet!jacobs.CS.ORST.EDU!louxj From: louxj@jacobs.CS.ORST.EDU (John W. Loux) Newsgroups: comp.editors Subject: Re: Awk Message-ID: <1991Mar09.192429.4939@lynx.CS.ORST.EDU> Date: 9 Mar 91 19:24:29 GMT References: <17851@cgl.ucsf.EDU> Sender: @lynx.CS.ORST.EDU Distribution: na Organization: Solve and Integrate Corp, Corvallis OR Lines: 22 Nntp-Posting-Host: jacobs.cs.orst.edu In article <17851@cgl.ucsf.EDU> alonso@maxwell.mmwb.ucsf.edu (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? > >[...] I couldn't find anything >on this in the awk book (Aho, Kernigan, Weiberger). In ``the book'' (The AWK Programming Language by Aho, Kernighan and Weinberger), page 25 says: ``In a relational comparison, if both operands are numeric, a numeric comparison is made; otherwise, any numeric operand is converted to a string, and then the operands are compared as strings. The strings are compared character by character using the ordering provided by the machine, most often the ASCII character set. One string is said to be `less than' another if it would appear before the other according to this ordering, e.g., "Canada" < "China" and "Asia" < "Asian".'' John