Today I had to remove the first 1131 bytes from an 800MB mixed text / binary file, a filtered subversion dump I'm hacking for a new repository. What's the best way to do this?
To start with I tried
dd bs=1 skip=1131 if=filtered.dump of=trimmed.dump
but after the skip this copies the remainder of the file a byte at a time, i.e. very slowly. In the end I worked out I needed 405 bytes to round this up to three blocks of 512 which I could skip
dd if=/dev/zero of=405zeros bs=1 count=405
cat 405zeros filtered.dump | dd bs=512 skip=3 of=trimmed.dump
which completed fairly quickly but there must have been a simpler / better way? Is there another tool I've forgotten about?
dd
is the right tool for the job - looks like you came up with a nice, elegant solution to your problem. – Justin Ethier Feb 03 '11 at 19:50