How to use the parallel command along with find command in bash












0














Trying to process a large list of files (~1000+)
The follow is a script that I am using..



for i in (find ./ -type f "*.properties");  
do
native2ascii -encoding UTF8 $i $i ; //java native2ascii
done;


This will take a really long time to complete. Wondering is there a better way that I can leverage the commend parallel or other command in bash to shorten the time it takes?










share|improve this question




















  • 3




    What does this have to do with Java?
    – shmosel
    Nov 21 at 0:27










  • @shmosel I guess because native2ascii is from java.
    – georgexsh
    Nov 21 at 7:34
















0














Trying to process a large list of files (~1000+)
The follow is a script that I am using..



for i in (find ./ -type f "*.properties");  
do
native2ascii -encoding UTF8 $i $i ; //java native2ascii
done;


This will take a really long time to complete. Wondering is there a better way that I can leverage the commend parallel or other command in bash to shorten the time it takes?










share|improve this question




















  • 3




    What does this have to do with Java?
    – shmosel
    Nov 21 at 0:27










  • @shmosel I guess because native2ascii is from java.
    – georgexsh
    Nov 21 at 7:34














0












0








0


1





Trying to process a large list of files (~1000+)
The follow is a script that I am using..



for i in (find ./ -type f "*.properties");  
do
native2ascii -encoding UTF8 $i $i ; //java native2ascii
done;


This will take a really long time to complete. Wondering is there a better way that I can leverage the commend parallel or other command in bash to shorten the time it takes?










share|improve this question















Trying to process a large list of files (~1000+)
The follow is a script that I am using..



for i in (find ./ -type f "*.properties");  
do
native2ascii -encoding UTF8 $i $i ; //java native2ascii
done;


This will take a really long time to complete. Wondering is there a better way that I can leverage the commend parallel or other command in bash to shorten the time it takes?







bash windows-subsystem-for-linux gnu-parallel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 7:26









georgexsh

10.1k11136




10.1k11136










asked Nov 21 at 0:27









leungc70

346




346








  • 3




    What does this have to do with Java?
    – shmosel
    Nov 21 at 0:27










  • @shmosel I guess because native2ascii is from java.
    – georgexsh
    Nov 21 at 7:34














  • 3




    What does this have to do with Java?
    – shmosel
    Nov 21 at 0:27










  • @shmosel I guess because native2ascii is from java.
    – georgexsh
    Nov 21 at 7:34








3




3




What does this have to do with Java?
– shmosel
Nov 21 at 0:27




What does this have to do with Java?
– shmosel
Nov 21 at 0:27












@shmosel I guess because native2ascii is from java.
– georgexsh
Nov 21 at 7:34




@shmosel I guess because native2ascii is from java.
– georgexsh
Nov 21 at 7:34












1 Answer
1






active

oldest

votes


















2














why not?



find ./ -type f "*.properties" | 
parallel -j 4 native2ascii -encoding UTF8 {} {}


{} is for the replacement of input, adjust -j to match your CPU utilization.






share|improve this answer























  • so putting in {} will act the same as the $i in for i in (find ./ ...) ?
    – leungc70
    Nov 21 at 15:48










  • basically yes, you could read its manual.
    – georgexsh
    Nov 21 at 15:48






  • 1




    -j defaults to number of cores. Do not quote {} twice. It is unsupported and will sometimes fail in newer versions. So use this instead: parallel native2ascii -encoding UTF8 {} {}
    – Ole Tange
    Nov 23 at 14:00












  • @OleTange thanks for the hit, i will examine the code and update later.
    – georgexsh
    Nov 23 at 17:36






  • 1




    use perl: {= 's/(..+)/_new1/' =} @leungc70
    – georgexsh
    Nov 24 at 2:55













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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%2fstackoverflow.com%2fquestions%2f53403630%2fhow-to-use-the-parallel-command-along-with-find-command-in-bash%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









2














why not?



find ./ -type f "*.properties" | 
parallel -j 4 native2ascii -encoding UTF8 {} {}


{} is for the replacement of input, adjust -j to match your CPU utilization.






share|improve this answer























  • so putting in {} will act the same as the $i in for i in (find ./ ...) ?
    – leungc70
    Nov 21 at 15:48










  • basically yes, you could read its manual.
    – georgexsh
    Nov 21 at 15:48






  • 1




    -j defaults to number of cores. Do not quote {} twice. It is unsupported and will sometimes fail in newer versions. So use this instead: parallel native2ascii -encoding UTF8 {} {}
    – Ole Tange
    Nov 23 at 14:00












  • @OleTange thanks for the hit, i will examine the code and update later.
    – georgexsh
    Nov 23 at 17:36






  • 1




    use perl: {= 's/(..+)/_new1/' =} @leungc70
    – georgexsh
    Nov 24 at 2:55


















2














why not?



find ./ -type f "*.properties" | 
parallel -j 4 native2ascii -encoding UTF8 {} {}


{} is for the replacement of input, adjust -j to match your CPU utilization.






share|improve this answer























  • so putting in {} will act the same as the $i in for i in (find ./ ...) ?
    – leungc70
    Nov 21 at 15:48










  • basically yes, you could read its manual.
    – georgexsh
    Nov 21 at 15:48






  • 1




    -j defaults to number of cores. Do not quote {} twice. It is unsupported and will sometimes fail in newer versions. So use this instead: parallel native2ascii -encoding UTF8 {} {}
    – Ole Tange
    Nov 23 at 14:00












  • @OleTange thanks for the hit, i will examine the code and update later.
    – georgexsh
    Nov 23 at 17:36






  • 1




    use perl: {= 's/(..+)/_new1/' =} @leungc70
    – georgexsh
    Nov 24 at 2:55
















2












2








2






why not?



find ./ -type f "*.properties" | 
parallel -j 4 native2ascii -encoding UTF8 {} {}


{} is for the replacement of input, adjust -j to match your CPU utilization.






share|improve this answer














why not?



find ./ -type f "*.properties" | 
parallel -j 4 native2ascii -encoding UTF8 {} {}


{} is for the replacement of input, adjust -j to match your CPU utilization.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 24 at 2:56

























answered Nov 21 at 7:31









georgexsh

10.1k11136




10.1k11136












  • so putting in {} will act the same as the $i in for i in (find ./ ...) ?
    – leungc70
    Nov 21 at 15:48










  • basically yes, you could read its manual.
    – georgexsh
    Nov 21 at 15:48






  • 1




    -j defaults to number of cores. Do not quote {} twice. It is unsupported and will sometimes fail in newer versions. So use this instead: parallel native2ascii -encoding UTF8 {} {}
    – Ole Tange
    Nov 23 at 14:00












  • @OleTange thanks for the hit, i will examine the code and update later.
    – georgexsh
    Nov 23 at 17:36






  • 1




    use perl: {= 's/(..+)/_new1/' =} @leungc70
    – georgexsh
    Nov 24 at 2:55




















  • so putting in {} will act the same as the $i in for i in (find ./ ...) ?
    – leungc70
    Nov 21 at 15:48










  • basically yes, you could read its manual.
    – georgexsh
    Nov 21 at 15:48






  • 1




    -j defaults to number of cores. Do not quote {} twice. It is unsupported and will sometimes fail in newer versions. So use this instead: parallel native2ascii -encoding UTF8 {} {}
    – Ole Tange
    Nov 23 at 14:00












  • @OleTange thanks for the hit, i will examine the code and update later.
    – georgexsh
    Nov 23 at 17:36






  • 1




    use perl: {= 's/(..+)/_new1/' =} @leungc70
    – georgexsh
    Nov 24 at 2:55


















so putting in {} will act the same as the $i in for i in (find ./ ...) ?
– leungc70
Nov 21 at 15:48




so putting in {} will act the same as the $i in for i in (find ./ ...) ?
– leungc70
Nov 21 at 15:48












basically yes, you could read its manual.
– georgexsh
Nov 21 at 15:48




basically yes, you could read its manual.
– georgexsh
Nov 21 at 15:48




1




1




-j defaults to number of cores. Do not quote {} twice. It is unsupported and will sometimes fail in newer versions. So use this instead: parallel native2ascii -encoding UTF8 {} {}
– Ole Tange
Nov 23 at 14:00






-j defaults to number of cores. Do not quote {} twice. It is unsupported and will sometimes fail in newer versions. So use this instead: parallel native2ascii -encoding UTF8 {} {}
– Ole Tange
Nov 23 at 14:00














@OleTange thanks for the hit, i will examine the code and update later.
– georgexsh
Nov 23 at 17:36




@OleTange thanks for the hit, i will examine the code and update later.
– georgexsh
Nov 23 at 17:36




1




1




use perl: {= 's/(..+)/_new1/' =} @leungc70
– georgexsh
Nov 24 at 2:55






use perl: {= 's/(..+)/_new1/' =} @leungc70
– georgexsh
Nov 24 at 2:55




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


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





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2fstackoverflow.com%2fquestions%2f53403630%2fhow-to-use-the-parallel-command-along-with-find-command-in-bash%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

Feedback on college project

Futebolista

Albești (Vaslui)