O'Reilly logo

Learning AWK Programming by Shiwang Kalkhanda

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The tolower (string) function

AWK has two functions for converting the case of the characters of a string. These functions are called tolower() and toupper(). The tolower() function takes a single string as an argument and returns a copy of that string, with all the uppercase characters converted to lowercase. The nonalphabetic characters are left unchanged. The following example illustrates the usage of the tolower() function:

$ vi tolower1.awkBEGIN    {    str = "Linux is derived from Unix. Unix is oldest OS."    lower_case_str = tolower(str)    print "Original String : ", str    print "Lowercase String : ", lower_case_str}$ awk -f tolower1.awk

The output of the execution of the previous code is as follows:

Original String : Linux is derived from Unix. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required