Insert string in binary file at top

How can i append a EBCDIC string of 100 bytes to 0th position of a binary file in UNIX.

use cat?

I am using cat, but it taking lot of minutes to add when the actual binary file is of 30-60GB.

I am looking for an alternate editing the file to improve the performance since I need to add only 100 bytes anytime.

Buy faster disks, perhaps? :smiley:

Seriously, I am not aware of an efficient general solution for this kind of problem... Does anybody know one? ...

How is this binary produced? Perhaps you can avoid to write the file twice using e.g. pipe or redirection and appending first the EBCDIC stream. But this assumes that you have somehow access to the program that generates this binary.

My guess is that all bet are lost if you're trying to append the string at the beginning of the file after it has been created.

Just my 2c,
Lo�c

How can i append a EBCDIC string of 100 bytes to 0th position of a binary file in UNIX.

If you are attempting to insert 100 bytes at the end , then it isn't appedning at all. As far as I know, it the File system has to rearrange the blocks to accomadate the new 100 bytes.

So if you are inserting 100 bytes at the head of 60GB file, ideally i think the performance would be appending 60GB data onto a 100bytes file. I guess so.