[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.3.2.3 String Comparison With POSIX Rules
The POSIX standard says that string comparison is performed based on the locale’s collating order. This is usually very different from the results obtained when doing straight character-by-character comparison.(32)
Because this behavior differs considerably from existing practice,
gawk
only implements it when in POSIX mode (see section Command-Line Options).
Here is an example to illustrate the difference, in an ‘en_US.UTF-8’
locale:
$ gawk 'BEGIN { printf("ABC < abc = %s\n", > ("ABC" < "abc" ? "TRUE" : "FALSE")) }' -| ABC < abc = TRUE $ gawk --posix 'BEGIN { printf("ABC < abc = %s\n", > ("ABC" < "abc" ? "TRUE" : "FALSE")) }' -| ABC < abc = FALSE |