[Home]
HomePage RecentChanges Frequently Asked Questions

case sensitivity

Indentifier names

The awk interpreter is lettercase sensitive. This means that [[variable_name?]]s that have different letter cases are distinct and separate from each other:

 # The identifiers dog,Dog and DOG represent separate variables
 BEGIN {
	dog = "Benjamin"
	Dog = "Samba"
	DOG = "Bernie"
	printf "The three dogs are named %s, %s and %s.\n", dog, Dog, DOG
 }

Pattern matching

Because awk is lettercase sensitive, pattern matching will only occur if the lettercase of the text matches that used in the pattern.

Performing case insensitive matching

There are several ways to perform case insensitive letter matching:

Using a character list

Converting the data to lowercase before attempting to match

The awk extraction and reporting language provides a variety of functions for converting strings to uppercase or to lowercase:

  • [[tolower?]] - Converts a string to lower case
  • [[toupper?]] - Converts a string to upper case

Edit this page View other revisions Administration
Last edited 2011年06月25日 05:14 UTC by pgas (diff)

Powered by sdf Creative Commons License <pierre.gaston+awk@gmail.com>

Awk Wiki by #awk is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

AltStyle によって変換されたページ (->オリジナル) /