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

Summary table of built-in string functions

The following table gives us a short description of the built-in string functions in AWK:

Function

Description

index(str, sub)

Returns the position of the sub substring in the str string . Returns 0 if it is not present.

length(string)

Returns the length of the str string or the length of $0 if no string is supplied.

substr(str, pos)

Returns the substring of the str string, beginning at the pos position and the remaining string.

substr(str, pos, num)

Returns the substring of the str string, beginning at the pos position up to the length of num.

sub(regex, replacement)

Substitutes a replacement string matched with the regex / string in $0 and returns the number ...

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