parallel: Bugfix: empty line and --colsep

This commit is contained in:
Ole Tange 2010-10-09 21:55:01 +02:00
parent cc7d613040
commit 428faf33b7
3 changed files with 15 additions and 1 deletions

View file

@ -4239,7 +4239,11 @@ sub get_column {
}
my $line = get_line_from_fh($fh);
if(defined $line) {
push @$unget_ref, split /$::opt_colsep/o, $line;
if($line ne "") {
push @$unget_ref, split /$::opt_colsep/o, $line;
} else {
push @$unget_ref, "";
}
$::opt_N = $#$unget_ref+1;
$Global::max_number_of_args = $::opt_N;
debug("col_unget_ref: @$unget_ref\n");

View file

@ -60,3 +60,6 @@ echo '### Test of -C'
echo '### Test of --trim n'
(echo 'a% c %%b'; echo a%c% b %d) | parallel -k --trim n --colsep %+ echo '"{1}_{3}_{2}_{4}"'
parallel -k -C %+ echo '"{1}_{3}_{2}_{4}"' ::: 'a% c %%b' 'a%c% b %d'
echo '### Test of bug: If input is empty string'
(echo ; echo abcbdbebf;echo abc) | parallel --colsep b -v echo {1}{2}

View file

@ -65,3 +65,10 @@ a_b_\ c\ _{4}
a_\ b\ _c_d
a_b_c_{4}
a_b_c_d
### Test of bug: If input is empty string
echo {2}
{2}
echo ac
ac
echo ac
ac