I want to invoke the tool via the Textmate 'Filter Through Command' command. 

The intention is to replace the BBEdit 'Textfactory' functionality, as larger textfactories tend to become hard to manage.

Is sed the tool of choice? Any best practices on using it for this purpose?