|
Something like this maybe:
#!/bin/bash
SEARCHSTRING="foo"
sed "s/${SEARCHSTRING}/${SEARCHSTRING}\n/g" infile | \
grep ${SEARCHSTRING} | wc -l
Did 2 quick tries. One on a text file an d the second on a script with a more complex searchstring. Both worked.
Hope this helps.
__________________
The dead stay dead and the living only wait to join them........
|