Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Asuming I have two files, one large file and one small file, I want to write the smaller file to the large file without overwriting the remaining part of the larger file.

Both are binary files, and the large file can become very large, so I want to avoid copying the whole file, as that will take some time. Is there any standard Linux console utility to do this, or do I need to write it myself?

share|improve this question
    
maybe this helps you: stackoverflow.com/questions/54365/… –  hasgarion Feb 24 '12 at 12:30

2 Answers 2

up vote 9 down vote accepted

This will overwrite the beginning of large-file with the contents of small-file:

dd if=small-file of=large-file conv=notrunc
share|improve this answer

I don't quite understand what you mean, but you can use cat:

cat smallfile >> largefile

This will append smallfile to largefile.

share|improve this answer
1  
smallfile needs to be at the beginning of largefile, not at the end. –  Wimmel Mar 1 '11 at 10:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.