<p><pre><code>
cat my_text_file.txt | tr -c a-zA-z '\n' | sed '/^$/d' | sort | uniq -i -c
</pre></code></p>
<p>EDIT TO ANSWER QUESTION IN COMMENT/REPLY SECTION</p>
<p>We kick things off with the cat command and give it the name of the file we want to examine. The cat command then passes the contents of our text file to "tr". The tr command breaks up the file, putting each word on its own line, for easy access. (The '\n' after "tr" indicates we want to add newline characters to our text.) We next filter our file through the sed command, which removes any empty lines. (The ^ immediately followed by the $ mean we're looking for lines that effectively have nothing between the beginning of the line and the end. The "d" on the end of the sed command indicates we want to delete any such lines.) The list of words we have is sorted alphabetically and then passed to the "uniq" command, which performs the actual count for us. Should we want to narrow things down so we just see the count for the word "love" we can append the grep program to our command in this manner:</p>
<p><pre><code>
cat my_text_file.txt | tr -c a-zA-z '\n' | sed '/^$/d' | sort | uniq -i -c | grep -i \ love$
</pre></code></p>