I have several (many) files; each is very large:
file0.txt file1.txt file2.txt
I do not want to join them in one file, because the resulting file will be 10+ Gigs. Each line in each file contains a 40-byte line. The lines are pretty well ordered right now (about 1:10 steps is a decrease in value instead of an increase).
I would like rows to be ordered. (in place, if possible?) This means that some of the lines from the end of file0.txt will be file0.txt to the beginning of file1.txt and vice versa.
I am working on Linux and quite new to this. I know about the sort command for a single file, but I'm wondering if there is a way to sort multiple files. Or maybe there is a way to make a pseudo file from small files, which linux will consider as a single file.
What I know can do: I can sort each file individually and read in file1.txt to find a value greater than the largest in file0.txt (and similarly grab lines from the end of file0.txt ), join and sort .. but it’s a pain and doesn’t take values from file2.txt to file0.txt (as if it’s unlikely in my case)
Edit
To be clear, if the files look like this:
f0.txt DDD XXX AAA f1.txt BBB FFF CCC f2.txt EEE YYY ZZZ
I want this:
f0.txt AAA BBB CCC f1.txt DDD EEE FFF f2.txt XXX YYY ZZZ
Paul
source share