From 7f731a54b711e7a580b925030107e036cc715b7f Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Wed, 4 May 2011 20:55:01 +0200 Subject: [PATCH] parallel: - as argfile will read from stdin --- doc/FUTURE_IDEAS | 14 ++++++++++++++ doc/release_new_version | 6 ++++++ src/parallel | 6 +++++- src/parallel.pod | 25 ++++++++++++++++++++----- 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/doc/FUTURE_IDEAS b/doc/FUTURE_IDEAS index 0956705f..db4d1d77 100644 --- a/doc/FUTURE_IDEAS +++ b/doc/FUTURE_IDEAS @@ -1,3 +1,17 @@ +parallel echo {1} {2} {3} ::: a b c :::: myfile ::: X Y + +parallel oggenc -q {1} {2} {2.}_{1}.ogg ::: 1 5 10 :::: wavfiles + +or + +parallel oggenc -q {1} {2} {2.}_{1}.ogg ::: 1 5 10 ::: *.wav + +or + +ls *.wav | parallel oggenc -q {1} {2} {2.}_{1}.ogg ::: 1 5 10 :::: - + + + Postkort: - Forside kun figur - Bagside: diff --git a/doc/release_new_version b/doc/release_new_version index 4636aec1..5a711c31 100644 --- a/doc/release_new_version +++ b/doc/release_new_version @@ -179,6 +179,12 @@ New in this release: * Robert from Echo One discusses using processes instead of threads: http://rrees.wordpress.com/2011/04/25/many-cores-many-threads/ +* How to run GNU Parallel on a SLURM cluster. Thanks to Kevin Stock. + http://www.kevinstock.org/2011/04/using-the-ri-cluster/ + +* Short article about using GNU Parallel with lame: + http://loopkid.net/articles/2011/04/30/accelerate-lame-mp3-conversion + * Bug fixes and man page updates. diff --git a/src/parallel b/src/parallel index d10cbd11..8376d83d 100755 --- a/src/parallel +++ b/src/parallel @@ -357,6 +357,7 @@ sub get_options_from_array { "block|block-size|blocksize=s" => \$::opt_blocksize, "tollef" => \$::opt_tollef, "gnu" => \$::opt_gnu, + "xapply" => \$::opt_xapply, # xargs-compatibility - implemented, man, testsuite "max-procs|P=s" => \$::opt_P, "delimiter|d=s" => \$::opt_d, @@ -398,7 +399,7 @@ sub get_options_from_array { sub parse_options { # Returns: N/A # Defaults: - $Global::version = 20110422; + $Global::version = 20110503; $Global::progname = 'parallel'; $Global::infinity = 2**31; $Global::debug = 0; @@ -733,6 +734,9 @@ sub open_or_exit { # file handle to read-opened file # exits if file cannot be opened otherwise my $file = shift; + if($file eq "-") { + return ($Global::original_stdin || *STDIN); + } my $fh = gensym; if(not open($fh,"<",$file)) { print STDERR "$Global::progname: ". diff --git a/src/parallel.pod b/src/parallel.pod index d6c1f9de..7096bd06 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -208,12 +208,18 @@ Read items from the file I instead of stdin (standard input). If you use this option, stdin is given to the first process run. Otherwise, stdin is redirected from /dev/null. -If multiple B<-a> are given, one line will be read from each of the -files. The arguments can be accessed in the command as B<{1}> -.. B<{>IB<}>, so B<{1}> will be a line from the first file, and -B<{6}> will refer to the line with the same line number from the 6th -file. +(Below is unimplemented. Acts like --xapply now) +If multiple B<-a> are given, all combinations of all lines will be +generated. E.g. 1 2 and a b c will result in the combinations (1,a) +(1,b) (1,c) (2,a) (2,b) (2,c). This is useful for replacing nested +for-loops. + +The arguments can be accessed in the command as B<{1}> +.. B<{>IB<}>, so B<{1}> will be a line from the first file, and +B<{6}> will refer to a line from the 6th file. + +See also B<--xapply> =item B<--arg-file-sep> I @@ -1154,6 +1160,15 @@ See also B<-m>. Exit if the size (see the B<-s> option) is exceeded. +=item B<--xapply> (Unimplimented) + +Read multiple files like B. If multiple B<-a> are given, one +line will be read from each of the files. The arguments can be +accessed in the command as B<{1}> .. B<{>IB<}>, so B<{1}> will be a +line from the first file, and B<{6}> will refer to the line with the +same line number from the 6th file. + + =item B<--shebang> =item B<--hashbang>