cat contents of one file into another file

Posted by Attila O. on Super User See other posts from Super User or by Attila O.
Published on 2012-12-15T22:31:47Z Indexed on 2012/12/15 23:07 UTC
Read the original article Hit count: 201

Filed under:
|
|

I have a large (binary) file that has some corruption near the beginning.

Then, I have a second, smaller file that I obtain by starting to download the same file again, but interrupt after I have enough bytes to fix the original one.

My question is, how do I simply overwrite the beginning of the large file with the contents of the second, smaller file? I could use cat, tail and head, but that would create a copy of the file. There must be a more efficient way.

Oh yes, and I'm looking for a linux command-line solution, if that wasn't obvious. I'm using bash, but I have other shells if that helps.

© Super User or respective owner

Related posts about linux

Related posts about command-line