язык сканирования и обработки шаблонов (pattern scanning and processing language)
Использование в приложениях (Application usage)
The index
, length
, match
, and substr
functions should not be
confused with similar functions in the ISO C standard; the awk
versions deal with characters, while the ISO C standard deals
with bytes.
Because the concatenation operation is represented by adjacent
expressions rather than an explicit operator, it is often
necessary to use parentheses to enforce the proper evaluation
precedence.
When using awk to process pathnames, it is recommended that
LC_ALL, or at least LC_CTYPE and LC_COLLATE, are set to POSIX or
C in the environment, since pathnames can contain byte sequences
that do not form valid characters in some locales, in which case
the utility's behavior would be undefined. In the POSIX locale
each byte is a valid single-byte character, and therefore this
problem is avoided.
On implementations where the "=="
operator checks if strings
collate equally, applications needing to check whether strings
are identical can use:
length(a) == length(b) && index(a,b) == 1
On implementations where the "=="
operator checks if strings are
identical, applications needing to check whether strings collate
equally can use:
a <= b && a >= b