linux – 将文件从给定的’x'(起始)偏移复制到给定’y'(结束)偏移的工具

是否有任何工具可以将文件从给定的起始偏移量复制到给定(结束)偏移量.我还想确认该工具通过运行md5sum正确地复制了指定的字节数.有点像这样
1) Copy source file starting from 100 byte till 250th byte
        $cp /path/to/source/file /path/to/dest/file -s 100 -e 250

   2) Create md5sum of the source file starting from 100byte till 250th byte
        $md5sum /path/of/src/file -s 100 -e 250
         xxxxxx-xxxxx-xxxxx-xxxx-xx

   3) Confirm that destination file created from step 1 is right by comparing the md5sum generated from step 2.
        $md5sum /path/of/dest/file
         xxxxxx-xxxxx-xxxxx-xxxx-xx

我知道md5sum没有-s和-e的选项,但我想通过给定源文件和目标文件的某些工具来确认.提前致谢

解决方法

1)你可以使用dd:
# dd if=/path/to/source/file of=/path/to/destination/file bs=1 skip=100 count=250

对于2)我不确定这是否可以通过标准工具实现.

[编辑]

啊哈,找到了一条路:

对于2)

# dd if=/path/to/source/file bs=1 skip=100 count=250 | md5sum

对于3)

md5sum /path/to/destination/file

相关文章

linux常用进程通信方式包括管道(pipe)、有名管道(FIFO)、...
Linux性能观测工具按类别可分为系统级别和进程级别,系统级别...
本文详细介绍了curl命令基础和高级用法,包括跳过https的证书...
本文包含作者工作中常用到的一些命令,用于诊断网络、磁盘占满...
linux的平均负载表示运行态和就绪态及不可中断状态(正在io)的...
CPU上下文频繁切换会导致系统性能下降,切换分为进程切换、线...