Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 583 Bytes

count.md

File metadata and controls

36 lines (22 loc) · 583 Bytes

string count TARGET [STRING]

This command will count the number of times TARGET occurs in the STRING.

Typical command line

    string count "friend" "The people were freindly"

Would return 1

    string count "tomato" "The people were freindly"

Would return 0

Piping content

NOTE: To read content from standard input we use the -i - option.

    echo "The people were friendly" | string -i - count "friend"

Would return 1

    echo "The people were friendly" | string -i - count "apple"

Would return 0