Visit Our UNIX and Linux User Community


complexing dd


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting complexing dd
# 1  
Old 10-24-2009
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!
# 2  
Old 10-24-2009
Quote:
Originally Posted by claw82
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?
Code:
{
 dd bs=3M skip=2 count=1 "$file"
 dd bs=3M skip=5 count=1 "$file"
}

# 3  
Old 10-24-2009
You could do this with multiple dd statements.

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

Code:
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: -

Code:
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: -

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


Previous Thread | Next Thread
Test Your Knowledge in Computers #824
Difficulty: Medium
HTML 5 specifies scripting application programming interfaces (APIs) that can be used with JavaScript.
True or False?

Featured Tech Videos