Loop through many folders and do calculations with files with similar pattern in bash

Clash Royale CLAN TAG#URR8PPP
I have several folders each containing several .nc files. I want to loop through all folders and for each folder do some calculations (mergetime) using cdo on files that have similar pattern. So far I have written the following:
for dir in /mnt/meteo_a/africa_cordex/historical/0.44/pr/*/
do
dir=$dir%*/
echo $dir##*/
export dir
cd $dir
pwd
for f in `find . -type f -regex /(.*?day)/*`
cdo mergetiem io
done
done
The files in each folder have names like the following:
pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_day_19500101-19501231.nc
pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_day_19510101-19551231.nc
pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1_day_19491201-19501231.nc
pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1_day_19510101-19551231.nc
I want to apply the mergetime CDO command on all files that have similar pattern before _day_.
I want to merge the first two files and the last two files. More specifically, merge files that start with
"pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_"
and likewise merge files that start with
"pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1"
The output of the mergetime can be something like:
pattern_mergetime.nc
bash files regular-expression
|
show 2 more comments
I have several folders each containing several .nc files. I want to loop through all folders and for each folder do some calculations (mergetime) using cdo on files that have similar pattern. So far I have written the following:
for dir in /mnt/meteo_a/africa_cordex/historical/0.44/pr/*/
do
dir=$dir%*/
echo $dir##*/
export dir
cd $dir
pwd
for f in `find . -type f -regex /(.*?day)/*`
cdo mergetiem io
done
done
The files in each folder have names like the following:
pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_day_19500101-19501231.nc
pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_day_19510101-19551231.nc
pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1_day_19491201-19501231.nc
pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1_day_19510101-19551231.nc
I want to apply the mergetime CDO command on all files that have similar pattern before _day_.
I want to merge the first two files and the last two files. More specifically, merge files that start with
"pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_"
and likewise merge files that start with
"pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1"
The output of the mergetime can be something like:
pattern_mergetime.nc
bash files regular-expression
It is not clear which files you want to select with yourfindcommand. Please show a list of files with some matching and some non-matching files and state which ones you want to select or which files belong into the same group(s). What exactly means "similar pattern before_day_"?
– Bodo
Feb 12 at 12:19
I want to merge the first two files and the last two files. More specifically, merge files that start with "pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_" and likewise merge files that start with "pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1".
– Maria Karypidou
Feb 12 at 12:20
Please add the clarification to your question instead of writing a comment.
– Bodo
Feb 12 at 12:28
I did that, thank you!
– Maria Karypidou
Feb 12 at 12:33
I had a quick look at the documentation ofcdo, and I found out that themergetimeoperator requires the name of theoutfile. The required arguments are as follows:cdo mergetime one_or_more_input_files one_outfile. So, what or how do you want to name your output files?
– Niko Gambt
Feb 12 at 13:16
|
show 2 more comments
I have several folders each containing several .nc files. I want to loop through all folders and for each folder do some calculations (mergetime) using cdo on files that have similar pattern. So far I have written the following:
for dir in /mnt/meteo_a/africa_cordex/historical/0.44/pr/*/
do
dir=$dir%*/
echo $dir##*/
export dir
cd $dir
pwd
for f in `find . -type f -regex /(.*?day)/*`
cdo mergetiem io
done
done
The files in each folder have names like the following:
pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_day_19500101-19501231.nc
pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_day_19510101-19551231.nc
pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1_day_19491201-19501231.nc
pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1_day_19510101-19551231.nc
I want to apply the mergetime CDO command on all files that have similar pattern before _day_.
I want to merge the first two files and the last two files. More specifically, merge files that start with
"pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_"
and likewise merge files that start with
"pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1"
The output of the mergetime can be something like:
pattern_mergetime.nc
bash files regular-expression
I have several folders each containing several .nc files. I want to loop through all folders and for each folder do some calculations (mergetime) using cdo on files that have similar pattern. So far I have written the following:
for dir in /mnt/meteo_a/africa_cordex/historical/0.44/pr/*/
do
dir=$dir%*/
echo $dir##*/
export dir
cd $dir
pwd
for f in `find . -type f -regex /(.*?day)/*`
cdo mergetiem io
done
done
The files in each folder have names like the following:
pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_day_19500101-19501231.nc
pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_day_19510101-19551231.nc
pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1_day_19491201-19501231.nc
pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1_day_19510101-19551231.nc
I want to apply the mergetime CDO command on all files that have similar pattern before _day_.
I want to merge the first two files and the last two files. More specifically, merge files that start with
"pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_"
and likewise merge files that start with
"pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1"
The output of the mergetime can be something like:
pattern_mergetime.nc
bash files regular-expression
bash files regular-expression
edited Feb 12 at 13:20
Maria Karypidou
asked Feb 12 at 12:05
Maria KarypidouMaria Karypidou
11
11
It is not clear which files you want to select with yourfindcommand. Please show a list of files with some matching and some non-matching files and state which ones you want to select or which files belong into the same group(s). What exactly means "similar pattern before_day_"?
– Bodo
Feb 12 at 12:19
I want to merge the first two files and the last two files. More specifically, merge files that start with "pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_" and likewise merge files that start with "pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1".
– Maria Karypidou
Feb 12 at 12:20
Please add the clarification to your question instead of writing a comment.
– Bodo
Feb 12 at 12:28
I did that, thank you!
– Maria Karypidou
Feb 12 at 12:33
I had a quick look at the documentation ofcdo, and I found out that themergetimeoperator requires the name of theoutfile. The required arguments are as follows:cdo mergetime one_or_more_input_files one_outfile. So, what or how do you want to name your output files?
– Niko Gambt
Feb 12 at 13:16
|
show 2 more comments
It is not clear which files you want to select with yourfindcommand. Please show a list of files with some matching and some non-matching files and state which ones you want to select or which files belong into the same group(s). What exactly means "similar pattern before_day_"?
– Bodo
Feb 12 at 12:19
I want to merge the first two files and the last two files. More specifically, merge files that start with "pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_" and likewise merge files that start with "pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1".
– Maria Karypidou
Feb 12 at 12:20
Please add the clarification to your question instead of writing a comment.
– Bodo
Feb 12 at 12:28
I did that, thank you!
– Maria Karypidou
Feb 12 at 12:33
I had a quick look at the documentation ofcdo, and I found out that themergetimeoperator requires the name of theoutfile. The required arguments are as follows:cdo mergetime one_or_more_input_files one_outfile. So, what or how do you want to name your output files?
– Niko Gambt
Feb 12 at 13:16
It is not clear which files you want to select with your
find command. Please show a list of files with some matching and some non-matching files and state which ones you want to select or which files belong into the same group(s). What exactly means "similar pattern before _day_"?– Bodo
Feb 12 at 12:19
It is not clear which files you want to select with your
find command. Please show a list of files with some matching and some non-matching files and state which ones you want to select or which files belong into the same group(s). What exactly means "similar pattern before _day_"?– Bodo
Feb 12 at 12:19
I want to merge the first two files and the last two files. More specifically, merge files that start with "pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_" and likewise merge files that start with "pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1".
– Maria Karypidou
Feb 12 at 12:20
I want to merge the first two files and the last two files. More specifically, merge files that start with "pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_" and likewise merge files that start with "pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1".
– Maria Karypidou
Feb 12 at 12:20
Please add the clarification to your question instead of writing a comment.
– Bodo
Feb 12 at 12:28
Please add the clarification to your question instead of writing a comment.
– Bodo
Feb 12 at 12:28
I did that, thank you!
– Maria Karypidou
Feb 12 at 12:33
I did that, thank you!
– Maria Karypidou
Feb 12 at 12:33
I had a quick look at the documentation of
cdo, and I found out that the mergetime operator requires the name of the outfile. The required arguments are as follows: cdo mergetime one_or_more_input_files one_outfile. So, what or how do you want to name your output files?– Niko Gambt
Feb 12 at 13:16
I had a quick look at the documentation of
cdo, and I found out that the mergetime operator requires the name of the outfile. The required arguments are as follows: cdo mergetime one_or_more_input_files one_outfile. So, what or how do you want to name your output files?– Niko Gambt
Feb 12 at 13:16
|
show 2 more comments
1 Answer
1
active
oldest
votes
This script snippet would work with your example files
for file in *.nc
do
echo "$file"
done | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
Explanation:
- The
forloop withechoprints one file name per line. - The
sedcommand removes_day_and all following characters. sort -usorts the partial file names and removes duplicates.while read -r patternreads one pattern per line and loops over the patterns"$pattern"*is expanded by the shell to all file names starting with the pattern
Better than the for loop with echo might be
find . -maxdepth 1 -type f -name '*.nc'
This will print all file names matching *.nc in the current directory without subdirectories.
You can combine this with a loop over all subdirectories similar to the script in the question
for dir in /mnt/meteo_a/africa_cordex/historical/0.44/pr/*/
do
dir=$dir%*/
echo $dir##*/
export dir
pushd $dir
pwd
find . -maxdepth 1 -type f -name '*.nc' | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
popd
done
Instead of cd I propose pushd to allow going back with popd later.
You could also replace the for loop over the directories with an additional find
find /mnt/meteo_a/africa_cordex/historical/0.44/pr -maxdepth 1 -mindepth 1 -type d | while read dir
do
pushd "$dir"
find . -maxdepth 1 -type f -name '*.nc' | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
popd
done
This works! Thank you!
– Maria Karypidou
Feb 12 at 13:33
@MariaKarypidou If it works you can accept the answer. I read in a comment that thecdocommand needs an output file argument. I will add this to my answer.
– Bodo
Feb 12 at 13:37
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500157%2floop-through-many-folders-and-do-calculations-with-files-with-similar-pattern-in%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This script snippet would work with your example files
for file in *.nc
do
echo "$file"
done | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
Explanation:
- The
forloop withechoprints one file name per line. - The
sedcommand removes_day_and all following characters. sort -usorts the partial file names and removes duplicates.while read -r patternreads one pattern per line and loops over the patterns"$pattern"*is expanded by the shell to all file names starting with the pattern
Better than the for loop with echo might be
find . -maxdepth 1 -type f -name '*.nc'
This will print all file names matching *.nc in the current directory without subdirectories.
You can combine this with a loop over all subdirectories similar to the script in the question
for dir in /mnt/meteo_a/africa_cordex/historical/0.44/pr/*/
do
dir=$dir%*/
echo $dir##*/
export dir
pushd $dir
pwd
find . -maxdepth 1 -type f -name '*.nc' | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
popd
done
Instead of cd I propose pushd to allow going back with popd later.
You could also replace the for loop over the directories with an additional find
find /mnt/meteo_a/africa_cordex/historical/0.44/pr -maxdepth 1 -mindepth 1 -type d | while read dir
do
pushd "$dir"
find . -maxdepth 1 -type f -name '*.nc' | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
popd
done
This works! Thank you!
– Maria Karypidou
Feb 12 at 13:33
@MariaKarypidou If it works you can accept the answer. I read in a comment that thecdocommand needs an output file argument. I will add this to my answer.
– Bodo
Feb 12 at 13:37
add a comment |
This script snippet would work with your example files
for file in *.nc
do
echo "$file"
done | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
Explanation:
- The
forloop withechoprints one file name per line. - The
sedcommand removes_day_and all following characters. sort -usorts the partial file names and removes duplicates.while read -r patternreads one pattern per line and loops over the patterns"$pattern"*is expanded by the shell to all file names starting with the pattern
Better than the for loop with echo might be
find . -maxdepth 1 -type f -name '*.nc'
This will print all file names matching *.nc in the current directory without subdirectories.
You can combine this with a loop over all subdirectories similar to the script in the question
for dir in /mnt/meteo_a/africa_cordex/historical/0.44/pr/*/
do
dir=$dir%*/
echo $dir##*/
export dir
pushd $dir
pwd
find . -maxdepth 1 -type f -name '*.nc' | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
popd
done
Instead of cd I propose pushd to allow going back with popd later.
You could also replace the for loop over the directories with an additional find
find /mnt/meteo_a/africa_cordex/historical/0.44/pr -maxdepth 1 -mindepth 1 -type d | while read dir
do
pushd "$dir"
find . -maxdepth 1 -type f -name '*.nc' | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
popd
done
This works! Thank you!
– Maria Karypidou
Feb 12 at 13:33
@MariaKarypidou If it works you can accept the answer. I read in a comment that thecdocommand needs an output file argument. I will add this to my answer.
– Bodo
Feb 12 at 13:37
add a comment |
This script snippet would work with your example files
for file in *.nc
do
echo "$file"
done | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
Explanation:
- The
forloop withechoprints one file name per line. - The
sedcommand removes_day_and all following characters. sort -usorts the partial file names and removes duplicates.while read -r patternreads one pattern per line and loops over the patterns"$pattern"*is expanded by the shell to all file names starting with the pattern
Better than the for loop with echo might be
find . -maxdepth 1 -type f -name '*.nc'
This will print all file names matching *.nc in the current directory without subdirectories.
You can combine this with a loop over all subdirectories similar to the script in the question
for dir in /mnt/meteo_a/africa_cordex/historical/0.44/pr/*/
do
dir=$dir%*/
echo $dir##*/
export dir
pushd $dir
pwd
find . -maxdepth 1 -type f -name '*.nc' | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
popd
done
Instead of cd I propose pushd to allow going back with popd later.
You could also replace the for loop over the directories with an additional find
find /mnt/meteo_a/africa_cordex/historical/0.44/pr -maxdepth 1 -mindepth 1 -type d | while read dir
do
pushd "$dir"
find . -maxdepth 1 -type f -name '*.nc' | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
popd
done
This script snippet would work with your example files
for file in *.nc
do
echo "$file"
done | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
Explanation:
- The
forloop withechoprints one file name per line. - The
sedcommand removes_day_and all following characters. sort -usorts the partial file names and removes duplicates.while read -r patternreads one pattern per line and loops over the patterns"$pattern"*is expanded by the shell to all file names starting with the pattern
Better than the for loop with echo might be
find . -maxdepth 1 -type f -name '*.nc'
This will print all file names matching *.nc in the current directory without subdirectories.
You can combine this with a loop over all subdirectories similar to the script in the question
for dir in /mnt/meteo_a/africa_cordex/historical/0.44/pr/*/
do
dir=$dir%*/
echo $dir##*/
export dir
pushd $dir
pwd
find . -maxdepth 1 -type f -name '*.nc' | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
popd
done
Instead of cd I propose pushd to allow going back with popd later.
You could also replace the for loop over the directories with an additional find
find /mnt/meteo_a/africa_cordex/historical/0.44/pr -maxdepth 1 -mindepth 1 -type d | while read dir
do
pushd "$dir"
find . -maxdepth 1 -type f -name '*.nc' | sed 's/_day_.*//' | sort -u | while read -r pattern
do
cdo mergetime "$pattern"* "$pattern_mergetime.nc"
done
popd
done
edited Feb 12 at 13:40
answered Feb 12 at 12:41
BodoBodo
2,048416
2,048416
This works! Thank you!
– Maria Karypidou
Feb 12 at 13:33
@MariaKarypidou If it works you can accept the answer. I read in a comment that thecdocommand needs an output file argument. I will add this to my answer.
– Bodo
Feb 12 at 13:37
add a comment |
This works! Thank you!
– Maria Karypidou
Feb 12 at 13:33
@MariaKarypidou If it works you can accept the answer. I read in a comment that thecdocommand needs an output file argument. I will add this to my answer.
– Bodo
Feb 12 at 13:37
This works! Thank you!
– Maria Karypidou
Feb 12 at 13:33
This works! Thank you!
– Maria Karypidou
Feb 12 at 13:33
@MariaKarypidou If it works you can accept the answer. I read in a comment that the
cdo command needs an output file argument. I will add this to my answer.– Bodo
Feb 12 at 13:37
@MariaKarypidou If it works you can accept the answer. I read in a comment that the
cdo command needs an output file argument. I will add this to my answer.– Bodo
Feb 12 at 13:37
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500157%2floop-through-many-folders-and-do-calculations-with-files-with-similar-pattern-in%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It is not clear which files you want to select with your
findcommand. Please show a list of files with some matching and some non-matching files and state which ones you want to select or which files belong into the same group(s). What exactly means "similar pattern before_day_"?– Bodo
Feb 12 at 12:19
I want to merge the first two files and the last two files. More specifically, merge files that start with "pr_AFR-44_CNRM-CERFACS-CNRM-CM5_historical_r1i1p1_CLMcom-CCLM4-8-17_v1_" and likewise merge files that start with "pr_AFR-44_ICHEC-EC-EARTH_historical_r12i1p1_CLMcom-CCLM4-8-17_v1".
– Maria Karypidou
Feb 12 at 12:20
Please add the clarification to your question instead of writing a comment.
– Bodo
Feb 12 at 12:28
I did that, thank you!
– Maria Karypidou
Feb 12 at 12:33
I had a quick look at the documentation of
cdo, and I found out that themergetimeoperator requires the name of theoutfile. The required arguments are as follows:cdo mergetime one_or_more_input_files one_outfile. So, what or how do you want to name your output files?– Niko Gambt
Feb 12 at 13:16