[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

dd skip_bytes=x count_bytes=x

From: Pádraig Brady
Subject: dd skip_bytes=x count_bytes=x
Date: Wed, 07 Oct 2009 12:12:17 +0100
User-agent: Thunderbird (X11/20071008)

Pádraig Brady wrote:
> On 16th June 2008, Paul Eggert wrote:
>> Pádraig Brady <address@hidden> writes:
>>> 5. I think it would be nice for dd to support reading portions of
>>> a file efficiently. As far as I can see it can only do it by reading
>>> 1 byte at a time. Perhaps skip_bytes=x and count_bytes=x would
>>> be useful additions?
>> These also sound like good suggestions.
> I just noticed in the info docs for dd that there
> is a method to achieve skip_bytes at least:
> (dd bs=1 skip=123456 count=0 && dd bs=8192) < file

For my reference one could also efficiently
achieve count_bytes using the following:

  dd bs=1 skip=$skip_bytes count=0
  dd bs=$bs count=$(($count_bytes / $bs))
  dd bs=$(($count_bytes % $bs)) count=1
) < file

Still, supporting those internal to dd would
be simpler, more portable and robust.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]