From 92d7c462e77e71e27e275aa0dc5c1727f82529ce Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sat, 7 Jan 2012 04:22:48 +0100 Subject: [PATCH] parallel: --header will now parse the first line and you can use column names as {colname}. Experimental => man missing. --- src/parallel | 2 +- testsuite/tests-to-run/test65.sh | 2 +- testsuite/wanted-results/test65 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/parallel b/src/parallel index 93aceb30..94d4308f 100755 --- a/src/parallel +++ b/src/parallel @@ -83,7 +83,7 @@ if($::opt_header) { ::debug("Delimiter: '$delimiter'"); for my $s (split /$delimiter/o, $line) { ::debug("Colname: '$s'"); - $command =~ s/\{$s\}/\{$id\}/g; + $command =~ s:\{$s(|/|//|\.|/\.)\}:\{$id$1\}:g; $id++; } } diff --git a/testsuite/tests-to-run/test65.sh b/testsuite/tests-to-run/test65.sh index d85f9cc1..b5886a60 100644 --- a/testsuite/tests-to-run/test65.sh +++ b/testsuite/tests-to-run/test65.sh @@ -25,7 +25,7 @@ echo '### Test --resume --joblog followed by --resume --joblog'; cat /tmp/joblog2 | wc; rm -f /tmp/joblog2; echo '### Test --header'; - printf "a\tb\n1\t2" | parallel --header echo {b} {a} + printf "a\tb\n1.2\t3/4.5" | parallel --header echo {b} {a} {b.} {b/} {b//} {b/.}; EOF echo '### Test --shellquote' diff --git a/testsuite/wanted-results/test65 b/testsuite/wanted-results/test65 index 0be2dd42..be42eef5 100644 --- a/testsuite/wanted-results/test65 +++ b/testsuite/wanted-results/test65 @@ -31,7 +31,7 @@ parallel: -H has been retired. Use --halt. ### Test --resume --joblog followed by --resume --joblog 5 49 205 ### Test --header -2 1 +3/4.5 1.2 3/4 4.5 3 4 ### Test --shellquote awk\ -v\ FS=\"\\\",\\\"\"\ \'\{print\ \$1,\ \$3,\ \$4,\ \$5,\ \$9,\ \$14\}\'\ \|\ grep\ -v\ \"\#\"\ \|\ sed\ -e\ \'1d\'\ -e\ \'s/\\\"//g\'\ -e\ \'s/\\/\\/\\//\\t/g\'\ \|\ cut\ -f1-6,11\ \|\ sed\ -e\ \'s/\\/\\//\\t/g\'\ -e\ \'s/\ /\\t/g ### Test make .deb package