I need to be able to create a very large text file from a small existing file. It needs to be as small as 1 MB and as big as 5 MB. Below is the initial starting file content.
I am told one can use "dd" command or "fallocate", but I don’t see a way to use these by growing an existing file. I would grateful for any ideas. Thanks
Delivered-To: firstname.lastname@example.org From: email@example.com To: firstname.lastname@example.org Delivered-To: email@example.com From: firstname.lastname@example.org To: email@example.com Delivered-To: firstname.lastname@example.org From: email@example.com
You can use
cat to concatenate the file multiple times.
cat file.txt file.txt file.txt > newfile.txt
will repeat the contents 3 times. If you want to make it dynamic, use a loop that appends.
numcopies=100 > newfile.txt for ((i = 0; i < numcopies; i++)); do cat file.txt >>newfile.txt done