Chander Shivdasani
Chander Shivdasani

Reputation: 10131

Editing large text files on linux ( 5 - 10gb)

Basically, i need a file of specified format and large size(Around 10gb). To get this, i am copying the contents of my original file into the same file, multiple times, to increase its size. I dont care about the contents of the file as long as they have the required format. Initially, i tried to do this using gedit, which failed miserably after few 100mbs. I'm looking for an editor which will help me do this. Or, may be a suggestion on alternate ways

Upvotes: 1

Views: 1115

Answers (2)

Jason
Jason

Reputation: 89179

In Windows, from the command line:

copy file1.txt+file2.txt file3.txt  

concats 1 and 2, places in 3 - repeat or add +args until you get the size you need.

For Unix,

cat file1.txt file2.txt >> file3.txt

concats 1 and 2, places in 3 - repeat or add more input files until you get the size you need.

There are probably many other ways to do this in Unix.

Upvotes: 1

Dave
Dave

Reputation: 11162

You could make 2 files and repeatedly append them to each other:

cp file1 file2

for x in `seq 1 200`; do 
       cat file1 >> file2
       cat file2 >> file1
done;

Upvotes: 2

Related Questions