index

Usage

index [ STRING, SUBSTRING ]

The index [[function?]] is used to locate the first occurrence of a [[substring?]] within a string. If the [[substring?]] cannot be found, then a value of [[zero?]] is returned:

BEGIN { print index("Staffordshire","ford") # 5 }

Case sensitivity

Note that awk is case sensitive, so a [[match?]] will only occur if the lettercase of the string matches that of the [[substring?]].