-1

I'm trying to remeove the first 8 bytes from binary file using the command:

dd if=new.pdf of=new2.pdf ibs=1 skip=8

but it's taking too long.

Is there a way to remove the first 8 bytes, in a faster way ?

Boom
  • 1,145
  • 18
  • 44
  • This question on the Unix&Linux Stack Exchange might help: https://unix.stackexchange.com/questions/6852/best-way-to-remove-bytes-from-the-start-of-a-file There are a few other related questions there, as well. – IMSoP Nov 24 '20 at 09:23
  • 2
    `but it's taking too long.` `ibs=1` - you are reading one character at a time! – KamilCuk Nov 24 '20 at 09:29

1 Answers1

1

ibs=1 is requesting dd to read one single byte at a time. It's going to be slow - for each byte, there is a context switch to the kernel.

I would:

tail -c+9 new.pdf > new2.pdf

I think you could use dd, choose the best block size for your specific environment, and... skip the bytes:

dd if=new.pdf of=new2.pdf bs=4M iflag=skip_bytes skip=8
KamilCuk
  • 120,984
  • 8
  • 59
  • 111