case conversion

The awk extraction and reporting language provides the toupper and tolower functions for converting strings to uppercase or to lowercase:

tolower

Usage

tolower(STRING)

Description

The tolower function returns a lowercase version of the STRING argument. This function converts all letters to lowercase in the returned string. Only the returned string is converted, the provided argument remains unchanged:

BEGIN {
  mystring = "I Like Apples"
  print (tolower(mystring))
  print mystring
}

toupper

Usage

toupper(STRING)

Description

The toupper function returns a lowercase version of the STRING argument. This function converts all letters to uppercase in the returned string. Only the returned string is converted, the provided argument remains unchanged:

BEGIN {
  mystring = "I Like AppLes"
  print (toupper(mystring))
  print mystring
}

These functions are affected by the locale settings

These function are affected by the following locale environment variable settings.