Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

skip the first 32k of stdin with dd?

Tags:

bash

stdout

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

like image 391
nwaltham Avatar asked Nov 23 '13 10:11

nwaltham


1 Answers

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
like image 70
devnull Avatar answered Oct 05 '22 03:10

devnull