parallel: --header will now parse the first line and you can use column names as {colname}. Experimental => man missing.

This commit is contained in:
Ole Tange 2012-01-07 04:22:48 +01:00
parent 8c4b0ba4b9
commit 92d7c462e7
3 changed files with 3 additions and 3 deletions

View file

@ -83,7 +83,7 @@ if($::opt_header) {
::debug("Delimiter: '$delimiter'"); ::debug("Delimiter: '$delimiter'");
for my $s (split /$delimiter/o, $line) { for my $s (split /$delimiter/o, $line) {
::debug("Colname: '$s'"); ::debug("Colname: '$s'");
$command =~ s/\{$s\}/\{$id\}/g; $command =~ s:\{$s(|/|//|\.|/\.)\}:\{$id$1\}:g;
$id++; $id++;
} }
} }

View file

@ -25,7 +25,7 @@ echo '### Test --resume --joblog followed by --resume --joblog';
cat /tmp/joblog2 | wc; cat /tmp/joblog2 | wc;
rm -f /tmp/joblog2; rm -f /tmp/joblog2;
echo '### Test --header'; 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 EOF
echo '### Test --shellquote' echo '### Test --shellquote'

View file

@ -31,7 +31,7 @@ parallel: -H has been retired. Use --halt.
### Test --resume --joblog followed by --resume --joblog ### Test --resume --joblog followed by --resume --joblog
5 49 205 5 49 205
### Test --header ### Test --header
2 1 3/4.5 1.2 3/4 4.5 3 4
### Test --shellquote ### 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 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 ### Test make .deb package