Search code examples
bashstdoutdd

skip the first 32k of stdin with dd?


If I have a file on a file system I can do something like this with dd:

dd  if=/my/filewithaheader.bin bs=32k skip=1 | gunzip | tar tvf

however if I try something like this:

./commandthatputsstuffonstdout |  dd  bs=32k skip=1 | gunzip | tar tvf

I get the error: dd: 'standard input': cannot skip to specified offset.

How can I fix this, can it be done with dd, or is there another unix command I can use


Solution

  • You could use tail. Say:

    ./commandthatputsstuffonstdout | tail -c +1025 ...
    

    to skip the first 1024 bytes of output produced by your command.

    From man tail:

       -c, --bytes=K
              output the last K bytes; alternatively,  use  -c  +K  to  output
              bytes starting with the Kth of each file