Skip to main content
added 359 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

Use xargs with -n 1 meaning "only pass one single argument to each invocation of the utility".

Something like:

printf '%s\n' file*.txt | xargs -n 1 -P 100 perl dataProcessing.pl

which assumes that the filenames don't contain literal newlines.

If you have GNU xargs, or an implementation of xargs that understands -0 (for reading nul-delimited arguments, which allows for filenames with newlines) and -r (for not running the utility with empty argument list, when file*.txt doesn't match anything and nullglob is in effect), you may do

printf '%s\0' file*.txt | xargs -r0 -n 1 -P 100 perl dataProcessing.pl

Note that thisboth of these variations may start up to 100 parallel instances of the script, which may not be what you want. You may want to limit it to a reasonable number related to the number of CPUs on your machine (or related to the total amount of available RAM divided by the expected memory usage per task, if it's memory bound).

Use xargs with -n 1 meaning "only pass one single argument to each invocation of the utility".

Something like:

printf '%s\0' file*.txt | xargs -r0 -n 1 -P 100 perl dataProcessing.pl

Note that this may start up to 100 parallel instances of the script, which may not be what you want. You may want to limit it to a reasonable number related to the number of CPUs on your machine (or related to the total amount of available RAM divided by the expected memory usage per task, if it's memory bound).

Use xargs with -n 1 meaning "only pass one single argument to each invocation of the utility".

Something like:

printf '%s\n' file*.txt | xargs -n 1 -P 100 perl dataProcessing.pl

which assumes that the filenames don't contain literal newlines.

If you have GNU xargs, or an implementation of xargs that understands -0 (for reading nul-delimited arguments, which allows for filenames with newlines) and -r (for not running the utility with empty argument list, when file*.txt doesn't match anything and nullglob is in effect), you may do

printf '%s\0' file*.txt | xargs -r0 -n 1 -P 100 perl dataProcessing.pl

Note that both of these variations may start up to 100 parallel instances of the script, which may not be what you want. You may want to limit it to a reasonable number related to the number of CPUs on your machine (or related to the total amount of available RAM divided by the expected memory usage per task, if it's memory bound).

Use xargs with -n 1 meaning "only pass one single argument to each invocation of the utility".

Something like:

printf '%s\0' file*.txt | xargs -r0 -n 1 -P 100 perl dataProcessing.pl

which assumes that the filenames don't contain literal newlines.

Note that this may start up to 100 parallel instances of the script, which may not be what you want. You may want to limit it to a reasonable number related to the number of CPUs on your machine (or related to the total amount of available RAM divided by the expected memory usage per task, if it's memory bound).

Use xargs with -n 1 meaning "only pass one single argument to each invocation of the utility".

Something like

printf '%s\0' file*.txt | xargs -r0 -n 1 -P 100 perl dataProcessing.pl

which assumes that the filenames don't contain literal newlines.

Note that this may start up to 100 parallel instances of the script, which may not be what you want. You may want to limit it to a reasonable number related to the number of CPUs on your machine (or related to the total amount of available RAM divided by the expected memory usage per task, if it's memory bound).

Use xargs with -n 1 meaning "only pass one single argument to each invocation of the utility".

Something like:

printf '%s\0' file*.txt | xargs -r0 -n 1 -P 100 perl dataProcessing.pl

Note that this may start up to 100 parallel instances of the script, which may not be what you want. You may want to limit it to a reasonable number related to the number of CPUs on your machine (or related to the total amount of available RAM divided by the expected memory usage per task, if it's memory bound).

added 4 characters in body
Source Link
Stéphane Chazelas
  • 584.6k
  • 96
  • 1.1k
  • 1.7k

Use xargs with -n 1 meaning "only pass one single argument to each invocation of the utility".

Something like

printf '%s\n''%s\0' file*.txt | xargs -r0 -n 1 -P 100 perl dataProcessing.pl

which assumes that the filenames don't contain literal newlines.

Note that this may start up to 100 parallel instances of the script, which may not be what you want. You may want to limit it to a reasonable number related to the number of CPUs on your machine (or related to the total amount of available RAM divided by the expected memory usage per task, if it's memory bound).

Use xargs with -n 1 meaning "only pass one single argument to each invocation of the utility".

Something like

printf '%s\n' file*.txt | xargs -n 1 -P 100 perl dataProcessing.pl

which assumes that the filenames don't contain literal newlines.

Note that this may start up to 100 parallel instances of the script, which may not be what you want. You may want to limit it to a reasonable number related to the number of CPUs on your machine (or related to the total amount of available RAM divided by the expected memory usage per task, if it's memory bound).

Use xargs with -n 1 meaning "only pass one single argument to each invocation of the utility".

Something like

printf '%s\0' file*.txt | xargs -r0 -n 1 -P 100 perl dataProcessing.pl

which assumes that the filenames don't contain literal newlines.

Note that this may start up to 100 parallel instances of the script, which may not be what you want. You may want to limit it to a reasonable number related to the number of CPUs on your machine (or related to the total amount of available RAM divided by the expected memory usage per task, if it's memory bound).

added 118 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Loading
added 68 characters in body
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Loading
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k
Loading