I have several directories ("amazon", "niger",...), in which I have several subdirectories ("gfdl", "hadgem",...), in which I also have several sub-directories ("rcp8p5", "rcp4p5",...). In this last subdirectories I always have two folders ("historical", "projected") that contain thousand of tables having the same frame.
Therefore, I would like to concatenate those tables (present in the two folders of the last sub-directories) in order to have just one big table with only one header and not an header each time that a table has been concatenate. Does anyone knows how to do that?
I am currently using the following loop structure:
#!/bin/bash
# usage:cat_dat dirname
data_dir=/scratch/01/stevens/climate_scenario/river
for river in tagus
do
for gcm in gfdl-esm2m hadgem2-es
do
for scenario in rcp8p5 rcp4p5 rcp6p0 rcp2p6
do
find "${data_dir}/${river}/${gcm}/${scenario}" name *.dat -exec cat {} + >> "${data_dir}/${river}/${gcm}/${scenario}.dat"
done
done
done
but I can´t get rid of the header with that! Any helps is greatly appreciated! Thanks!