I have a file that is in txt format and delimited by tabs, here is an extract:
id 1 2 4 15 18 20
1_at 100 200 89 189 299 788
2_at 8 78 33 89 90 99
3_xt 300 45 53 234 89 34
4_dx 49 34 88 8 9 15
Now I have a file, also in txt format, and separated with commas with the following data:
18,1,4,20
So based on that file, I would like to read it and extract only the columns from the first tabulated data so I can store in another file like this:
(important: I need to keep the order of the data to be stored according to the csv file)
id 18 1 4 20
1_at 299 100 89 788
2_at 90 8 33 99
3_xt 89 300 53 34
4_dx 9 49 88 15
If the data that I want to extract would be the rows it would be easier because I could read it row by row and comparing to my txt file (I have already done that), but I am stuck with this column stuff.
I wonder if there is any way to extract directly the columns using some subindex function?
Any help will be greatly appreciated.