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.
ultraedit_scripts_v0_0_1.zip (https)
MD5: C218BF518291499600B7B769AD3D14EE
SHA256: CE8FAFF9F7708B6CF596EE455735656F902C5DC99A47EB8AA35F217E6E03656C
Hi Didier,
I’m just curious what it is that makes you prefer UltraEdit over 010 Editor on Windows?
Comment by Anonymous — Wednesday 8 January 2014 @ 22:14
I don’t prefer one over the other, because I use them for different goals.
010 Editor to work on all type of binary files, UltraEdit over all types of text documents.
A programmer’s editor is quite different from a hex editor.
With UltraEdit, I can do things that 010 doesn’t do, some examples:
– syntax highlighting
– command completion
– FTP/SFTP open/save
– commenting a block
– ident lines
While 010 has a lot of features for binary files that UltraEdit doesn’t have.
– templates
– data types
– binary operations
– …
Comment by Didier Stevens — Wednesday 8 January 2014 @ 22:18
Thanks for your article.
Just wanted to add from my experience with these editors Im absolutely addicted to Notepad++ for my string manipulations. Specifically for what you’ve mentioned ill write a regex with a combination with “replace” option. Because of the well established nature of regex ive found that this give the most flexabilty before writing a python script. In regex, I use “grouping” to mark different text parts and in the rest of the replace ill use my groups to create a new string.
Comment by Anonymous — Thursday 9 January 2014 @ 0:01
Unfortunately, not everything can be solved with re. For example, one of the next scripts I’m to release is a counter.
Comment by Didier Stevens — Saturday 11 January 2014 @ 22:11