I want to extract particular column from the file1 by comparing with file2 in which column number is given that should be extracted from file1.
File 1 (source data) look like this:
1 2 3 4 5 10 11 14
13 25 37 2 4 7 9 23
12 12 23 15 17 18 24 25
File 2 (with the column numbers to extract):
2
4
5
So I want to compare both file1 and file2. Using file 2 I want to extract columne number 2,4,5 from file1.
Desired output:
2 4 5
25 2 4
12 15 17
How can I proceed for that?