March 2018
Beginner to intermediate
416 pages
9h 24m
English
The IGNORECASE variable is used to make the GAWK program case-insensitive or case-sensitive. By default, IGNORECASE is set to 0, making the GAWK program case-sensitive. When we set IGNORECASE to 1, the GAWK program becomes case-insensitive. This has a major affect on regular expression and string comparisons.
In the following example, we are looking for the records containing the string chabra, with a lowercase c in the employee database file emp.dat. However, the last name begins with a capital letter, and hence only chabra is there:
$ awk '/chabra/{print}' emp.dat
Upon the execution of the preceding code, we will not get any output. Now, we set IGNORECASE to 1, and again print the records containing chabra. It will do a case-insensitive ...
Read now
Unlock full access