On 8/26/05, Gus Wirth <[EMAIL PROTECTED]> wrote:
> At 22:52 08/26/2005 -0700, Todd Walton wrote:
> >I'm trying to figure out how to use dd to do only a stretch of data.
> >I have a large chunk of data that I want to feed to another program.
> >So I say "dd if=largechunk |program"  But, I want to feed, say, one
> >half of the large chunk at one go, and then the second half in another
> >go.  How do I do this?
> >
> >I see the options for seek and skip, but I don't understand what it
> >says they're doing.
> >
> >seek=BLOCKS
> >              skip BLOCKS obs-sized blocks at start of output
> >
> >skip=BLOCKS
> >              skip BLOCKS ibs-sized blocks at start of input
> >
> >So, with seek, I can feed only a latter half of the chunk to the
> >program, and with skip I can read in only the latter chunk of the
> >data??  How do I ever get to the first part?
> >
> >"info dd" just gives me the man page for dd.
> 
> To get the first part all you have to do is count bytes. For example, to
> read the first 1000 bytes from file DATA:
> 
> dd if=DATA bs=1 count=1000 | some-program
> 
> Use any combination of block size (bs) and count that you need to read out
> the data from the beginning of the file.

Better to do bs=1000 count=1, I think.

Seek means pass over the beginning of an existing output file before
starting to write.  Skip means pass over the beginning of the input
file before starting to read.
Count determines how much data is transferred.  All working in units of bs.

Input file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
       skip - - - - - - - - - - - -^
                                           count - - - - - - - - - - - - - -
Output file . . . . . . . . . . . . . . . . . . . . . . . . . . 
      seek - - - - - ^
                           count - - - - - - - - - - - - - -
Don't know how well this will come out because of the variable-width font.
In the default case, both skip and seek are zero, and the data is just
copied from the beginning of the input, and writes at the beginning of
the output.  Also in the default case, count just runs to the end of
the input file.

    carl
-- 
    carl lowenstein         marine physical lab     u.c. san diego
                                                 [EMAIL PROTECTED]


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list
  • Re: dd Carl Lowenstein

Reply via email to