1

I'm using Windows 7 64-bit. I've got around 10,000 or so files that I want to edit. The trouble is that's just far too much to do by hand. I'll explain what I need to do below.

In these files, there is a string that begins with (the characters in the second line are in hexadecimal):

textures\  
74 65 78 74 75 72 65 73 5C 

And ends with:

_n.dds  
5F 4E 2E 64 64 73

It is followed by seven dots\seven pairs of 00's in hex:

.......  
00 00 00 00 00 00 00

Now, what I want to do is:

  • Copy the string excluding the dots/00's.
  • Insert a comma between the fourth and fifth dot so 00 00 00 00 00 00 00 becomes 00 00 00 00 2C 00 00 00
  • Paste the string after the seventh 00
  • Edit the pasted string so 5F 4E 2E 64 64 73 becomes 5F 50 2E 64 64 73 (or in text, "_n.dds " becomes "_p.dds")
  • Save the change

I've tried googling for hex editors that would facilitate such a thing, but I've come up dry. I didn't even find anything relevant to scripting/programming, aside from searching for files via strings inside them. And for the record, I don't know a lick of programming. So how would I go about doing this? There's far too many for me to do this by hand.

I uploaded an archive of two files. One file is without the change, the second is with it; for those who are curious or need this to get a proper idea of what I want to do.

  • this might help a bit pastebin.com/raw.php?i=dh63k9Am but still far from batch. but once you have something command line it's possible to make it batch. xxd.exe is part of vim for windows. this could be done from cmd though I did that line in cygwin, but i'm not sure off hand how to make it some wiz bang thing for all your files. but at least you could see how echo xxd and sed(or perl) can be used together. the syntax for sed is s/find/replace/ and if replacing many occurrences. s/find/replace/g – barlop Jan 6 '14 at 1:28
  • I'm just able to slightly grasp what you're saying. What do you mean by "vim for windows"? I also don't know anything about cygwin, aside from that it's a compiler of sorts iirc? Much obliged anyhow; I'll see what I can muster :D – FiftyTifty Jan 6 '14 at 23:30
  • Well. I can easily rearrange the hex for one file and show you how to do that. My command demonstrates doing that. You could work on figuring that out (I can explain that no problem), and then from there, ask questions of how to A)Do it to multiple files B)do it either so i- the new 'hex' overwrites the file ii-the new hex makes a new file. By 'B' I mean, say you have a file called filename1 and you look through its contents and replace the word 'there' with the word 'here', do you want the new output written as filename1 or filename1b? – barlop Jan 7 '14 at 1:57
  • Cygwin provides an alternative shell, alternative to cmd.exe It provides a load of commands that *nix machines use. It is not a compiler! Vim is like a mad text editor, but the installation includes a command called xxd.exe which I used. The fact that you didn't google vim or cygwin, vim.org/download.php cygwin.com "Cygwin is: a collection of tools which provide a Linux look and feel environment for Windows." nd the vim website says 'the editor" it's not like google can't tell you vim is a text editor, and you know what a text editor is don't you. – barlop Jan 7 '14 at 2:01
  • the intelligence you show re the hex suggests you could grasp that command and perhaps ask the right further questions.. But the fact that you haven't heard of vim or cygwin, and didn't even google it, isn't promising. The best way to grasp the command I used is to reproduce it yourself. But to not have even googled cygwin.. not easy. As I say, my command is only the basis for a solution..it still needs 'A' and 'B' mentioned in my earlier comment. I hope you at least know the echo command. – barlop Jan 7 '14 at 2:03
1

Google Search for 'Batch hex editor' found this: Batch Hex Editor - Which probably will do what you want, but perhaps not in the free version.

Hexplorer has the ability to record macros which may be suitable for what you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.