How to use the parallel command along with find command in bash
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
add a comment |
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
3
What does this have to do with Java?
– shmosel
Nov 21 at 0:27
@shmosel I guess becausenative2asciiis from java.
– georgexsh
Nov 21 at 7:34
add a comment |
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
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
bash windows-subsystem-for-linux gnu-parallel
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 becausenative2asciiis from java.
– georgexsh
Nov 21 at 7:34
add a comment |
3
What does this have to do with Java?
– shmosel
Nov 21 at 0:27
@shmosel I guess becausenative2asciiis 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
add a comment |
1 Answer
1
active
oldest
votes
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.
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
-jdefaults 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
|
show 1 more comment
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
});
}
});
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%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
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.
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
-jdefaults 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
|
show 1 more comment
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.
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
-jdefaults 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
|
show 1 more comment
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.
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.
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
-jdefaults 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
|
show 1 more comment
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
-jdefaults 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
|
show 1 more comment
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.
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%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
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
3
What does this have to do with Java?
– shmosel
Nov 21 at 0:27
@shmosel I guess because
native2asciiis from java.– georgexsh
Nov 21 at 7:34