I have a dataset in a text file (dataframe.txt), the header of the file is the variable name in numbers. The meaning of the numbers (the actual name of the variable) is stored in another file (variables.txt). For example (edited for simplicity:
> head dataframe.txt
123 456 789
1 2 3
4 5 6
7 8 9
> variables.txt
123 A
456 B
789 C
I would like to change the header of the dataframe.txt to the names that are stored in the variables.txt file. The link between numbers and name needs to stay the same. The desired output would be:
> head dataframe.txt
A B C
1 2 3
4 5 6
7 8 9
Is there a way to change the header according to another file that links the numbers with the name? I can imagine that a few lines of awk could do the trick..
Thank you!