Here is something to add to your toolkit: JEdit
This is a free programmers editor. It is outstanding with text.
But the best part is is the macro language.
You can record temporary macros and it shows you all the commands it created. You can then use this as the basis for a more permanent macro.
You do NOT want to use this to create content, but for sucking in .txt or .html files and cleaning them up or doing regular expression search or replaces - it works great.
I take text files and re-format the paragraphs, then add <p> tags.
Then another macro searches for chapter breaks and converts them to <div id='chapter'> tags. Etc.