I am running a model which produces text files as outputs, 17 variables are reported, with different names (i.e. variable1_X.out, variable2_.out.....variable17_X.out) being X the file number corresponding to the specified parameter used in the simulation, which is variable. Since I was working with few files I was extracting the data from the variables I need, with a basic script and plotting the data, however, by varying some of the model parameters, now I am producing a variable number of files, hence, my script is not useful anymore, and updating it with every run is not practical.
I managed to import all the files I want into R with lapply, however I was wondering if there is a tool/script in order to extract specific columns from each of the files I need and then plotting them altogether. The problem is that the column's names order in the output files is not constant and it changes from variable to variable. However, the names are the same in most of the files, so the selection should be based on specific names' list (chemical species like Al+++, Ca++, Na+....). R is not my field of expertise.