If I have the text in a shell variable, say $a:
$a
a=\"The cat sat on the mat\"
How can I search for \"cat\" and return 4 using a
echo $a | grep -bo cat | sed 's/:.*$//'