The `length (string)` function is used to calculate the length of a string. If the string is a number, the length of the digits in the string representing the number is returned—for example:

$ vilength1.awkBEGIN {print "Example of length calculation of string"print "length(hello..!) : " length("hello..!")print "Example of length calculation of number"print "length(10*20) : " length(10*20)

}$ awk -f length1.awk

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

Example of length calculation of stringlength(hello..!) : 8Example of length calculation of numberlength(10*20) : 3

If no argument is given to the length function, then it returns the length of `$0`. For example, we can use the length function ...