Hi, I have the following problem. I have files with one column of data (let's say file1.dat, file2.dat...file6.dat), and I would like to record the first value of the column of each file into another file (let's name it fileall.dat), which would have the the six values, one in each column. I use to do it as follows,
for line in $(ls); do head -1 $line >> myfile; done
worked as well if I had the files, whose first lines I want to put together, in the same directory, but it is not like this. I've skipped the details. What I wanted is to join together the first value of 6 files named fort.605 in one file, each in a different directory, i.e:
approach1.dir/fort.605
...
approach6.dir/fort.605
The first way is straightforward, but thanks a lot