CaseInsensitive

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;