只复制文件的某些字节?

Mat*_*att 4 bash files

如何从 $N 字节开始复制文件?

我可以-r像这样使用 curl 的选项:从字节 41663 及以后下载,但是如何使用本地文件执行此操作?我可以使用拆分,并使每个文件成为我想要的偏移量的大小,但这只会使文件复杂化。$ curl -r 41663- http://server.com/file.ext

有没有一种简单的方法可以做到这一点?

Jo-*_*tad 6

您可以使用该dd命令。很抱歉回答很短。您必须在手册中查找它。man dd将解释它是如何工作的。

  • `dd if=input-file of=output-file skip=number-of-bytes bs=1` (4认同)

Jam*_*dge 6

您应该能够使用tail命令的-c选项执行此操作:

-c, --bytes=K
       output the last K bytes; alternatively,  use  -c  +K  to  output
       bytes starting with the Kth of each file
Run Code Online (Sandbox Code Playgroud)

因此,要执行类似于 curl 调用的操作,您可以执行以下操作:

tail -c +41663 file.ext > copy.ext
Run Code Online (Sandbox Code Playgroud)