Hi All,
Dunno if anyone remembers me
– I used to be a fairly strong presence here 10 or 20 years ago, but I stopped keeping up with things around COVID time, and I’m just getting back into things now. Haiku has remained my favourite OS though; I’ve just been using Linux a bit more. (Just FYI, I’m 90 years old now(!), so I probably set the record of “Oldest Haiku User”!)
Anyway, there’s this app that I mostly wrote 25 years or so ago, but I’ve never really promoted. I use it on a regular basis, though, and I don’t think it’s like anything else around, so maybe it’s worth pushing a bit. I think what decided me was that a few months ago I had a (massive) log file that somehow got corrupted with a batch of nulls, and no text editor seemed to like that much! Maybe it’s just my ignorance, but I couldn’t find any easy way of removing them, until I suddenly realized it was trivial for my program (“matt”)! The command was simply:
matt -v ‘\000’ badfile > goodfile
(see the manual for explanation)
In passing it’s worth noting that, unlike grep, matt is perfectly happy with binary files; it has a switch to make certain it’s dealing with arbitrary 8-bit bytes, but it always accepts any byte, including null. So, if you can figure out the pattern you want (maybe as octal codes), go ahead and scan your binary.
So, if I haven’t lost you already, I’d better detail what the program does! It’s basically a regular expression matcher like ‘grep’, except that it uses Rob Pike’s “Structural Regular Expressions”. These are just like normal Regular Expressions", except they match their target exactly, rather than the line containing the match. This means the match can be a segment of a line or extend over many lines. I realize that languages such as Ruby and Python now have similar regex facilities, but I don’t know any command line app that does.
But wait, there’s more!
matt also has an optional ‘template’ argument that can edit the match in useful ways. You can select segments of the total match, and add arbitrary text that can depend on whether a specific segment is non-null or not. Together with the more flexible regexs, this makes matt a useful little utility.
I think this is becoming a pretty long post, so I won’t go into more detail here. Please check out my website: https://goodeveca.net/matt for all the details.
BTW, as a command-line app,matt is cross-platform. It compiles from unmodified sources on Linux and Android. (I don’t have either Mac or Windows, but I imagine it’s the same. Let me know if not.) I’ll add direct links to the most important packages here:
Haiku hpkg:
/matt_1.5-x86-gcc2.hpkg
Matt Manual:
MattManual.html
Cross-Platform Sources:
matt_1.5_src.zip
Please check the app out – I’d hate to die and be forgotten! Any feedback much appreciated! No AI was used in the making of this program! Be aware that I won’t be putting this on HaikuDepot; ATM I’ don’t even know how.
I hereby give permission to add any of the BeOS/Haiku apps you find on my website to the HaikuDepot pool. I’d appreciate credit is all.