aoxk61
March 18th, 2006, 02:41 PM
Hi,
I have the following code which counts the number of specific words in a file by separating each word onto a new line, and then using grep to count how many lines there are with that word.
tr ' \t' '\n\n' < text | grep -c "$word"
What I am trying to do now is use this code to count how many sentences there are in the file. I want it to basically separate each sentence which ends with a full stop onto a new line and then use grep to count how many lines with full stops there are. Any help would be appreciated.
Thanks a lot.
I have the following code which counts the number of specific words in a file by separating each word onto a new line, and then using grep to count how many lines there are with that word.
tr ' \t' '\n\n' < text | grep -c "$word"
What I am trying to do now is use this code to count how many sentences there are in the file. I want it to basically separate each sentence which ends with a full stop onto a new line and then use grep to count how many lines with full stops there are. Any help would be appreciated.
Thanks a lot.