I know awk has IGNORECASE to make the operation case insensitive. But I am not able to figure out how to use it in a for loop.
For example: Consider this awk script:
{
for (i = 1; i <= NF; i++)
counter[$i]++
}
Here I know I can use tolower, but what if I want to do it with IGNORECASE = 1, so that it ignores case while counting.
tolower seems the way to go. Look here for further info:
“In general, you cannot use IGNORECASE to make certain rules case-insensitive and other rules case-sensitive, because there is no straightforward way to set IGNORECASE just for the pattern of a particular rule.17 To do this, use either bracket expressions or tolower(). However, one thing you can do with IGNORECASE only is dynamically turn case-sensitivity on or off for all the rules at once.”
from: The GNU Awk User’s Guide
EDIT:
You should think about a better specification of your problem. Try this:
HTH Chris