Extract same file from multiple directories with same name i.e. 00000.gz?












0















Extract the file from multiple folders with same name into some other folder with diffrent name..



If possible with increasing count file1 to file100.



As of now if i run this command then it only saves one file which includes content of last file extracted in last folder.



for d in ./*/ ; do 
(cd "$d" && for f in *.gz ; do gunzip -c "$f" > /home/$USER/awss3extract/"$f" ; done);
done









share|improve this question

























  • From my understanding you have e.g. files ./dirA/00001.gz and ./dirB/00001.gz, right? What should be the result when you unzip both of them to the directory $HOME/awss3extract? What names should they have in this case?

    – PerlDuck
    Jan 27 at 16:53











  • You can use seq to generate sequences of numbers, or find to get a list of files, or bash's$(( arithmetic. Please explain: are all the files in the *.gz named the same?

    – waltinator
    Jan 27 at 22:49
















0















Extract the file from multiple folders with same name into some other folder with diffrent name..



If possible with increasing count file1 to file100.



As of now if i run this command then it only saves one file which includes content of last file extracted in last folder.



for d in ./*/ ; do 
(cd "$d" && for f in *.gz ; do gunzip -c "$f" > /home/$USER/awss3extract/"$f" ; done);
done









share|improve this question

























  • From my understanding you have e.g. files ./dirA/00001.gz and ./dirB/00001.gz, right? What should be the result when you unzip both of them to the directory $HOME/awss3extract? What names should they have in this case?

    – PerlDuck
    Jan 27 at 16:53











  • You can use seq to generate sequences of numbers, or find to get a list of files, or bash's$(( arithmetic. Please explain: are all the files in the *.gz named the same?

    – waltinator
    Jan 27 at 22:49














0












0








0








Extract the file from multiple folders with same name into some other folder with diffrent name..



If possible with increasing count file1 to file100.



As of now if i run this command then it only saves one file which includes content of last file extracted in last folder.



for d in ./*/ ; do 
(cd "$d" && for f in *.gz ; do gunzip -c "$f" > /home/$USER/awss3extract/"$f" ; done);
done









share|improve this question
















Extract the file from multiple folders with same name into some other folder with diffrent name..



If possible with increasing count file1 to file100.



As of now if i run this command then it only saves one file which includes content of last file extracted in last folder.



for d in ./*/ ; do 
(cd "$d" && for f in *.gz ; do gunzip -c "$f" > /home/$USER/awss3extract/"$f" ; done);
done






server gzip






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 27 at 17:03







rabbi bhumbla

















asked Jan 27 at 16:22









rabbi bhumblarabbi bhumbla

63




63













  • From my understanding you have e.g. files ./dirA/00001.gz and ./dirB/00001.gz, right? What should be the result when you unzip both of them to the directory $HOME/awss3extract? What names should they have in this case?

    – PerlDuck
    Jan 27 at 16:53











  • You can use seq to generate sequences of numbers, or find to get a list of files, or bash's$(( arithmetic. Please explain: are all the files in the *.gz named the same?

    – waltinator
    Jan 27 at 22:49



















  • From my understanding you have e.g. files ./dirA/00001.gz and ./dirB/00001.gz, right? What should be the result when you unzip both of them to the directory $HOME/awss3extract? What names should they have in this case?

    – PerlDuck
    Jan 27 at 16:53











  • You can use seq to generate sequences of numbers, or find to get a list of files, or bash's$(( arithmetic. Please explain: are all the files in the *.gz named the same?

    – waltinator
    Jan 27 at 22:49

















From my understanding you have e.g. files ./dirA/00001.gz and ./dirB/00001.gz, right? What should be the result when you unzip both of them to the directory $HOME/awss3extract? What names should they have in this case?

– PerlDuck
Jan 27 at 16:53





From my understanding you have e.g. files ./dirA/00001.gz and ./dirB/00001.gz, right? What should be the result when you unzip both of them to the directory $HOME/awss3extract? What names should they have in this case?

– PerlDuck
Jan 27 at 16:53













You can use seq to generate sequences of numbers, or find to get a list of files, or bash's$(( arithmetic. Please explain: are all the files in the *.gz named the same?

– waltinator
Jan 27 at 22:49





You can use seq to generate sequences of numbers, or find to get a list of files, or bash's$(( arithmetic. Please explain: are all the files in the *.gz named the same?

– waltinator
Jan 27 at 22:49










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1113316%2fextract-same-file-from-multiple-directories-with-same-name-i-e-00000-gz%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1113316%2fextract-same-file-from-multiple-directories-with-same-name-i-e-00000-gz%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

File:DeusFollowingSea.jpg