Oct-14-2018, 01:59 PM
I suggest a 3 steps procedure
Step 1: A python program reads the
Step 2 Run gnu sort on
Step 3 Read
Step 1: A python program reads the
big.txt
file line by line and creates a new big file bigggg.txt
by replacing each lineOutput:foo/bar/baz spam/eggs ham/bacon
withOutput:bacon foo/bar/baz spam/eggs ham/bacon| . |
Notice that the primary key has been added in front of each line and the white space between tokens has been normalized to a single space. At the end of the line, the initial blocks of white space have been written, separated by dots and enclosed between pipe characters.Step 2 Run gnu sort on
bigggg.txt
, producing sbigggg.txt
Step 3 Read
sbigggg.txt
line by line and write sbig.txt
by the reverse operation on each line.