You're viewing a comment by Paul and its responses.

Paul Permalink
July 29, 2009, 15:31

For Sydney 10/8/2008, who writes:
AWK in my usage of it only appears to evaluate the first number of the “20%”. so I ask; What usage of AWK should I implement to make 1 compare lower than 10.

Unix awk does not have strtonum but you don't need it, nor substr. The problem is that variables are treated both as string and numeric by the comparison operators. Trick is to typecast to numeric using (0 + expression), or to string using ("" expression), to force the right comparison. For a variable $3 like 17%, use x = 0 + $3 to assign the 17 part to x.

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "browser_92": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.