Hi,
I am having trouble sorting one file based on another file. I tried the grep -f function and failed. Basically what I have is two files that look like this:
File 1 (the list)
gh
aba
for
hmm
File 2 ( the file that needs to be sorted)
aba 2 4 6 7
for 2 4 7 4
hmm 1 2 7 4
gh 2 5 7 9
So file 1 is a list that has names in a particular order and I want to sort file 2 according to that order while also extracting the other columns.
So the end output would look like this.
Final file
gh 2 5 7 9
aba 2 4 6 7
for 2 4 7 4
hmm 1 2 7 4
the file is tab separated.
Thanks
Phil