7-zip will extract the part of a file from a multi-part rar, and then you can stitch them back together with dd. For example, if you have the first and last rar-parts:
7z x p1.rar
mv dir p1 # rename out of the way
7z x plast.rar
unrar l p1.rar
# note the file size of the entire file
ls -l dir/file # note the size of the last part
dd if=dir/file of=p1/file conv=notrunc bs=1 seek=$((full_size - lastpart_size))
If the offset you need to seek to isn't prime, then use a block size larger than one. dd
can only seek
to multiples of the output block size. dd
really does make read
and write
system calls with that block size, so bs=1
really sucks.
A large ibs
(input block size) would save half the CPU time, since seek
is in units of obs
(output block size). Or maybe there's some other tool which can seek to an arbitrary byte position and then do normal-sized I/Os. Or if you were scripting this, you could dd with bs=1
up to 32k-aligned, then maybe tail -c +$misalignment lastpart/file | dd ... of=p1/file conv=notrunc bs=32k seek=$(( (full_size - lastpart_size + misalignment) / (32 * 1024) ))