Page 1 of 1
cross-file find/replace [solved]
Posted: Sun Feb 22, 2009 12:23 am
by Firestryke31
I'm working on something where there are variations on a large number of small files. What I really need is a find/replace program that either works from the command line or works on ~100 files with one click. It's a simple 64-bit number (actually two 32 bit numbers right next to each other) that would be very nice to be able to replace in all of the already filtered files. These files were generated by manually exporting each of the relevant resources, and I'd rather not go through it again (high risk of mistake since they're scattered randomly through the source).
If anyone has any suggestions that would prevent me from having to write this utility that would be nice! I have MinGW and MSYS if that helps. Any *nix solutions?
Edit: This is what I get for not searching before posting. This is twice now I've made a fool of myself.
replacehex - find and replace raw hex in a file from a command line
Re: cross-file find/replace
Posted: Sun Feb 22, 2009 11:53 am
by Firestryke31
Sorry, I should have put a [solved] in the title when I edited it. The utility in the first post does more or less exactly what I want, and wrote a batch script to do the rest. Now, all I have to do is drag a PNG with a certain name style to it, and it will copy the contents of a folder to a temporary location, use replacehex to change the colors according to the name of the PNG file, then move it all to a folder with the same name as the PNG file. Then I can just zip it up and post it online.
Re: cross-file find/replace [solved]
Posted: Sun Feb 22, 2009 1:51 pm
by Firestryke31
Well, actually the only thing I use the PNG for is it's name. The PNG is simply a preview of what the end result will look like, and is named with the hex codes of 2 colors which the batch file uses to change the color in a bunch of resources that are meant to be imported. In fact, I could just create an empty file with the name and the end result would be the same.
For those that care, they're the selector bar colors for the 5th generation iPod's v1.3 firmware, and are stored in resource files that describes some other aspects of the selector bar for each menu.
For example, say I want the colors #FFFF00 for the top color of the selector bar gradient and #DADA23 for the bottom color, I'd create a PNG called FFFF00-DADA23.png which would contain a preview of the end result (so the user can download the one they want at a glance) and drag the PNG to the batch file. The batch file then lops off the extension and separates the name into the 2 colors, then uses those to replace all of the original colors with the new ones in each file.