mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 22:17:54 +00:00
parallel: --results with more data columns than headers caused undefined error. Fixed.
This commit is contained in:
parent
bbc9a53ea5
commit
d0ae4330ea
32
src/parallel
32
src/parallel
|
@ -4313,13 +4313,8 @@ sub args_as_dirname {
|
||||||
my @res = ();
|
my @res = ();
|
||||||
|
|
||||||
for my $rec_ref (@{$self->{'arg_list'}}) {
|
for my $rec_ref (@{$self->{'arg_list'}}) {
|
||||||
no warnings 'numeric';
|
my @header_indexes_sorted = header_indexes_sorted($#$rec_ref+1);
|
||||||
my @header_indexes_sorted = sort {
|
|
||||||
# Sort headers numerically then asciibetically
|
|
||||||
$Global::input_source_header{$a} <=> $Global::input_source_header{$b}
|
|
||||||
or
|
|
||||||
$Global::input_source_header{$a} cmp $Global::input_source_header{$b}
|
|
||||||
} 1 .. $#$rec_ref+1;
|
|
||||||
for my $n (@header_indexes_sorted) {
|
for my $n (@header_indexes_sorted) {
|
||||||
CORE::push(@res,
|
CORE::push(@res,
|
||||||
$Global::input_source_header{$n},
|
$Global::input_source_header{$n},
|
||||||
|
@ -4334,6 +4329,29 @@ sub args_as_dirname {
|
||||||
return join "/", @res;
|
return join "/", @res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub header_indexes_sorted {
|
||||||
|
# Sort headers first by number then by name.
|
||||||
|
# E.g.: 1a 1b 11a 11b
|
||||||
|
# Returns:
|
||||||
|
# Indexes of %Global::input_source_header sorted
|
||||||
|
my $max_col = shift;
|
||||||
|
|
||||||
|
no warnings 'numeric';
|
||||||
|
for my $col (1 .. $max_col) {
|
||||||
|
# Make sure the header is defined. If it is not: use column number
|
||||||
|
if(not defined $Global::input_source_header{$col}) {
|
||||||
|
$Global::input_source_header{$col} = $col;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
my @header_indexes_sorted = sort {
|
||||||
|
# Sort headers numerically then asciibetically
|
||||||
|
$Global::input_source_header{$a} <=> $Global::input_source_header{$b}
|
||||||
|
or
|
||||||
|
$Global::input_source_header{$a} cmp $Global::input_source_header{$b}
|
||||||
|
} 1 .. $max_col;
|
||||||
|
return @header_indexes_sorted;
|
||||||
|
}
|
||||||
|
|
||||||
sub len {
|
sub len {
|
||||||
# The length of the command line with args substituted
|
# The length of the command line with args substituted
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
Loading…
Reference in a new issue