CaseInsensitive

Last edit

Summary: new import

Changed:

< * Use tolower()

to

> {{{}}}**Use tolower()**

Changed:

< ** portable
< ** must be explicitly used for each comparison

to

> * portable
> * must be explicitly used for each comparison

Changed:

< * Use IGNORECASE=1;
< **
gawk only
< ** used for all comparisons, regex comparisons, index() function
< ** not used for array indexing

to

> {{{}}} **Use IGNORECASE=1;**
> *
gawk only
> * used for all comparisons, regex comparisons, index() function
> * not used for array indexing


Use tolower()

Instead of:

  if (avar=="a" || avar=="A") { ... }

Use:

  if (tolower(avar)=="a") { ... }

Or at the beginning of your code, add a line like:

  { for (i=0;i<=NF;i++) $i=tolower($i) }
  { $0=tolower($0); }   # modern awks will rebuild $1..$NF also

Use IGNORECASE=1;