UltraEdit is my text editor on Windows. I developed a couple of simple scripts that I’m going to release.
The first one is SubstituteEachLine.js.
I run this script when I need to transform each line into another form. Take this example where I want to create a Python dictionary with these words:
I start my script and type this template (%% is the placeholder for each original line in the document):
The script replaces each line in the document like this:
I also often use this in a command-line environment with a limited shell. For example, to rename a bunch of files in “DOS”, I put the list of filenames in a text document and then run my script: “ren %% %%.old”. As shown in this example, you can use the placeholder (%%) more than once in the template. But you can’t escape the placeholder string.
PS: you can also use regex search and replace to do this, but there are cases were I prefer my script.