Generate GBs of file using one small file in linux

In this blog, I will share the shell script which will generate/create a big file (GBs of Data). Consider a small file which has very less records (say 3 records). See the below SS of the sample Data.

Using above file we will write code to append data of this file to another file multiple times which results in a big output file.

echo "COL1|COL2" > linux_copy_.txt
for i in {1..100}
do
cat linux.txt |tail -n+2 >> linux_copy.txt
done


First line of code is about creating another file “linux_copy.txt” and adding header to this file which is same as header of original file(linux.txt). Then, running for loop 100 times and taking the data of a file without header(tail -n+2) and appending it to the same file which is created using echo command.

Related posts