complexing dd

Hello!

i wanna do dd of a file, but with some peculiarities, if i have a file with 30 Mb, and i do blocks of 3Mb(bs=3M), how can i do dd only in the block 3 and 6 for example?

Thanks!

{
 dd bs=3M skip=2 count=1 "$file"
 dd bs=3M skip=5 count=1 "$file"
}

You could do this with multiple dd statements.

To scale things down, this is an input file with five bytes per line: -

poweredge:/home/brad/forum/skipdd>cat ddout
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020

To read the third block of five bytes: -

poweredge:/home/brad/forum/skipdd>dd if=ddout bs=5 skip=2 count=1       
1003
1+0 records in
1+0 records out

To read the 6th block: -

poweredge:/home/brad/forum/skipdd>dd if=ddout bs=5 skip=5 count=1
1006
1+0 records in
1+0 records out