This command will count the number of times TARGET occurs in the STRING.
string count "friend" "The people were freindly"
Would return 1
string count "tomato" "The people were freindly"
Would return 0
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