Inserting and Appending Text with TextSoap

On the surface this seems like a silly, even trivial request, insert a line of text at the top of the file and append a line of text to the bottom of the file. And it is a simple request, until you want to do it in bulk.

Then it becomes a copy/paste nightmare that is woefully inefficient or you get into sed, cat, echo, for .. each loops and some other variants of shell scripting.

What I wanted to do was add code blocks to top and bottom of several Markdown files so they would be seen as code. Groovy code to be specific with the:
”’groovy
”’
While looking for a reliable solution that could be easily implemented, I caught something in TextSoap. It has an Insert Action. It’s an insert Before and After action. When no text is selection, the action is performed on the entire block of text. Since TextSoap has a menu bar button, the action can be performed anywhere.

That lead to this simple solution:textsoap-action

But there is a little more. TextSoap has a Batch File Cleaning function. There you can specify the Cleaner and the files it should act on.

textsoap-batch-cleaning

There is also the TextSoap Palette, which is a floating menu of all the TextSoap filters, including all the Custom Cleaners so it can be repeatedly used with any open application.

textsoap-palette

So what started as shell scripting exercise, turned into a simple two-line insert function within TextSoap that is now available to all applications or could even be run against a series of files. That was pretty handy!

That's my story and I'm sticking to it.

Author Signature for Posts

0