If you’re using Mac OS X, I can’t recommend SilverService strongly enough. You may be aware that applications can provide services to service-aware software. They’ll show up in the “Services” submenu of every service-aware application’s application menu and can act on that application’s documents.
SilverService lets you put your scripts in that menu. Select text in a service-aware application (such as Smultron or Safari), choose your script from the Services menu, and the selected text will be piped to your script. Whatever your script prints out will replace your selected text. This is a great way to merge your command-line scripts with the Mac OS X GUI.
You can download SilverService from http://www.rho.org.uk/software/silverservice/
Note that SilverService is currently (a) abandoned, and (b) PowerPC, so it requires Rosetta. But it is open source, so someone may take it up again later. It works great up to at least Mac OS X 10.6 Snow Leopard.