by davidork · 7y ago · 0 comments
dd skip=10 iflag=skip_bytes if=original.file of=first10ktrimmed.file
despite being old, and the amount of insanely horrible things you can do when you mess up the syntax or mistype something using it, dd is fucking amazing.
to be fair, its not directly editing the file, but making a copy with the first 10k skipped.
you could have a jump/pointer that points to the shortened first block of the file and then at the end of that, a pointer/jump to pick up where the rest of the file continues, but you'd wind up with misalignment and fs fragmentation.
What if you need to chop the first 10 bytes from a file that is more than half your disk?
The question is to how to trim the file head _in place_.
...so missing the point of the question entirely.