Search code examples
bashfilenamescdo-climate

how can I select only specific .nc files from long list to work with cdo?


How can I merge only specific .nc files to work with cdo? from a long list of files that look like this:

var_1-2.nc

var_3-4.nc

var_5-6.nc

.

.

var_99-100.nc

I would like to to a cdo mergetime only to the last e.g 10 files Anyone could help me with the syntax here?


Solution

  • The correct syntax for this issue is:

    cdo mergetime $(ls | tail -n 10) outfile.nc