I don't know if you're still looking for answers to this, but I thought I'd have a bash anyway (no pun intended :).
To count the f's in myfile.txt
grep counts only lines, so the sed replaces all f's with f followed by newline (the new line in that sequence is quite deliberate). I guess if you research a bit, you could probably come up with something less clumsy
sed -e 's/f/f\
/g' myfile.txt |grep --count f
A sentence count might be (probably some flaws in my thinking here but what the hell)
sed -e 's/\bmilk\b/\0\
/g' myfile.txt |grep --count "\bmilk\b"
To assign the output from a command such as those above to a variable in your script, you need to surround the sequence with the backtick (`) character.
sed -e 's/[\.\?\!]+/\0\
/g' myfile.txt |grep --count "[\.\?\!]"
To add an extra line you could use:
To replace a word, modify that sed above (the one that replaces milk with milk newline).
As for your menu function, I can only assume bash doesn't like recursion much. One way around it would be:
This will create a never ending loop. Of course you could add a quit option and put it in as a condition to the while loop.
<your menu code>
Edit: corrected half baked sentence count (a bit)