[prev in list] [next in list] [prev in thread] [next in thread] 

List:       coreutils
Subject:    Re: Is it possible to dd from a position in a file to the end?
From:       Pádraig_Brady <P () draigBrady ! com>
Date:       2019-02-20 8:06:33
Message-ID: 8e963daa-de95-3bb4-b143-c571f50e5bd6 () draigBrady ! com
[Download RAW message or body]

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic