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 toupper (string) function

The toupper() function takes a single string as an argument and returns a copy of that string, with all the lowercase characters converted to uppercase. The nonalphabetic characters are left unchanged. The following example illustrates the usage of the toupper() function:

$ vi toupper1.awkBEGIN    {    str = "Linux is derived from Unix. Unix is oldest OS."    upper_case_str = toupper(str)    print "Original String : ", str    print "Uppercase String : ", upper_case_str}$ awk -f toupper1.awk

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

Original String :  Linux is derived from Unix. Unix is oldest OS.Uppercase String :  LINUX IS DERIVED FROM UNIX. UNIX IS OLDEST OS.

Similarly, in our next example, we convert ...

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