$matchtok

From Scriptwiki
Jump to: navigation, search

Returns tokens that contain the specified string.

$matchtok(tokens,string,N,C)

Note that if you specify zero for N, it returns the total number of matching tokens.

Example

echo -ag $matchtok(This is a test, is, 0, 32)

This example returns 2, as the string This is a test contains is two times (This and is).

echo -ag $matchtok(This is a test, is, 1, 32)

This example returns This as it's the first string containing is.