Vim: Use selected text as input to a shell command

This is most likely common knowledge but I keep forgetting how to do it. If you want to run shell command on a small section of text in file you have open in vim, here is how. In visual-mode, select the text.

 
Now hit : and you should see :'<, '> at the prompt
 
 
Now following that, type :w !<command>, where <command> is the command you want to run. In my case I wanted to see how many characters were in the selected text, so I used 'wc -w'. Then hit enter.
 
 
The result should show itself in the output section. In my case, there were 22 words.
 
 
Happy Viming!