2
Is there a tool (or option for sort
) which will re-order lines of a file so that they are ordered like a key in another file?
For example, I have a data file:
T01F01475558 30
T01F022B3A17 31
T01F022EEDFD 19
T01F026E0209 19
And another (sort "key" file):
T01F022EEDFD
T01F026E0209
T01F022B3A17
T01F01475558
Is there a way to sort the first file so that the first field is in the same order as the 2nd file? Each key is unique (no duplicates), and there are an equal number of lines in each file.
Is there a UNIX tool I don't know about that will do this?