8

指定された開始オフセットから指定された(終了)オフセットにファイルをコピーするツールはありますか?また、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のオプションがないことは知っていますが、ソースファイルと宛先ファイルを指定してツールで確認したいと思います。前もって感謝します

4

1 に答える 1

16

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
于 2012-08-08T15:20:45.970 に答える