I need to concatenate chunks from two files:
if I needed concatenate whole files, I could simply do
cat file1 file2 > output
But I need to skip first 1MB from the first file, and I only want 10 MB from the second file. Sounds like a job for dd
.
dd if=file1 bs=1M count=99 skip=1 of=temp1
dd if=file2 bs=1M count=10 of=temp2
cat temp1 temp2 > final_output
Is there a possibility to do this in one step? ie, without the need to save the intermediate results? Can I use multiple input files in dd
?
Best Answer
dd
can write to stdout too.