coreutils
[Top][All Lists]
Advanced

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

Re: Is it possible to dd from a position in a file to the end?


From: Pádraig Brady
Subject: Re: Is it possible to dd from a position in a file to the end?
Date: Wed, 20 Feb 2019 00:06:33 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 19/02/19 11:46, Peng Yu wrote:
> Hi, I don't see a way to specify "END" in dd. I don't want to count
> the length a file in another command. Is there a way to let dd dump
> from a given location to the end? Thanks.

There is no way at present, without first determining the size
and seeking relative to that.

  dd seek=$calculated_size oflag=seek_bytes ...

If you wanted to replace the end of a file in place,
and if atomicity isn't a concern (which it couldn't be if
the size was big enough), one might combine truncate like:

  truncate -s -$size file
  dd conv=notrunc oflag=oappend ...

If you just wanted to read the last portion of a file,
one could use tail (which also supports devices since v8.29) like:

  tail -c$size ...

cheers,
Pádraig



reply via email to

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