Awk provides us with several built in functions for manipulating numbers and strings.
A list of these functions and a description of what they do is shown below :-
| Function Name | Operation |
|---|---|
| length(string) |
returns the number of characters in string; if you do not supply an argument, it returns the number of characters in the current input record. |
| int(number) | returns the integer portion of number. |
| index(string1, string2) | returns the index of string2 in string1 or 0 if string2 is not present. |
| split(string, array, delimiter) | places elements of string, delimited by the delimeter, in the array array[1]...array[n]; returning the number of elements in the array. |
| sprintf(format, arguments) | formats arguments according to the format and returns the formatted string; mimics the C programming language function of the same name. |
| substr(string, position, length) | returns a substring of string that begins at position and is length characters long. |