I am referring to How can you concatenate two huge files with very little spare disk space?
I'm in the midst of implementing the following:
- Allocate a sparse file of the combined size.
- Copy 100Mb from the end of the second file to the end of the new file.
- Truncate 100Mb of the end of the second file
- Loop 2&3 till you finish the second file (With 2. modified to the correct place in the destination file).
- Do 2&3&4 but with the first file.
I would like to know if is there anyone there who are able to "truncate" a given file in linux? The truncation is by file size, for example if the file is 10GB, I would like to truncate the first 100MB of the file and leave the file with remaining 9.9GB. Anyone could help in this?
Thanks
Copyright Notice:Content Author:「CheeHow」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/18072180/truncating-the-first-100mb-of-a-file-in-linux