Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/… – user4711 Feb 24 '12 at 12:30
    
@Wimmel, Shouldn't this be asked on unix.stackexchange.com ? – Pacerier May 2 '15 at 13:15
up vote 12 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
1  

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .