I have generated a bunch of files which all contain just one number. I then have some information about these files in each filename. What I want to do, is to collect all file contents as a column in a new file, and then get some part of each filename as separate columns in this new file.
The filenames look like this: traj-num1-iter-num2-states-num3.gradient, where num1, num2, and num3 are just different numbers. An example of what I want:
$ cat traj-10-iter-220-states-01.gradient
-0.0014868599999999788
$ cat newfile
traj iter states gradient
10 220 01 -0.0014868599999999788
I suspect this can be achieved, but I don't know how.