Here's a little OS X service to filter selected text (from any application) through a shell command.
This can be handy for performing quick operations, like replacing text with regular expressions, sorting lists or swapping fields around.
Grab the Filter through Shell Command service, extract the zip file and put the service into /Library/Services. You may need to authenticate to do this. It should then appear in the Services menu.
When triggered, the service requests a command to use for filtering, then runs the command and replaces the selected text with the result.
Some sample operations:
Mac OS X Hints
http://hints.macworld.com/article.php?story=201005230713587