1
1
I have a fairly large database of files. The files have very different extensions (.txt, .doc, .ppt etc), but every one of them has a certain phrase at the start of the file which has to be removed.
So, let's say I have a file randomtext.doc. Looking at the file in a simple text editor, the file would normally begin with:
\D0\CFࡱ\E1\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00>\00\00\FE\FF \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00K\00\00\00\00\00\00\00\00\00\00M\00\00\00\00\00\00\FE\FF\FF\FF\00\00\00\00J\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\
But my file begins with:
MYPHRASE \D0\CFࡱ\E1\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00>\00\00\FE\FF \00\00\00\00\00\00\00\00\00\00\00\00\00\00\00K\00\00\00\00\00\00\00\00\00\00M\00\00\00\00\00\00\FE\FF\FF\FF\00\00\00\00J\00\00\00\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\FF\
Deleting the phrase in a regular text editor ruins the file (for example, this file, which would normally be a .doc file, wouldn't be able to be viewed by Microsoft Word). I need to be able to delete the phrase, but keep the file extension etc.
Note: I wanted to add some error handling to the batch file. The changelog for 0.6beta3 states that support for errorlevel exit code has been added, but I could not get it to work (it always seemed to set errorlevel to 0, even when the output clearly stated that an error had occurred). Does anyone know how errorlevel works for dd for Windows, or is it a bug? – Karan – 2013-05-25T19:37:16.250