DanM DanM - 1 year ago 93
Linux Question

How do I extract a single chunk of bytes from within a file?

On a Linux desktop (RHEL4) I want to extract a range of bytes (typically less than 1000) from within a large file (>1 Gig). I know the offset into the file and the size of the chunk.

I can write code to do this but is there a command line solution?

Ideally, something like:

magicprogram --offset 102567 --size 253 < input.binary > output.binary

Answer Source

Try dd:

dd skip=102567 count=253 if=input.binary of=output.binary bs=1
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download