7 td-trans - Transform whitespace-delimited into TAB-delimited lines ignoring sorrounding whitespace.
13 =item -m, --max-columns I<NUM>
15 Maximum number of columns.
16 The I<NUM>th column may have any whitespace.
17 By default it's the number of fields in the header (first line).
23 $OptMaxColumns = undef;
25 'm|max-columns=i' => \
$OptMaxColumns,
28 no if ($] >= 5.018), 'warnings' => 'experimental::smartmatch';
29 do '/usr/lib/tool/perl5/tabdata/common.pl' or die "$@";
31 while(my $line = <STDIN
>)
37 if($. == 1 and not defined $OptMaxColumns)
39 # the first line considered header,
40 # and the number of fields dictates (at most) how many fields are there in the rest of the stream.
41 $OptMaxColumns = scalar split /\s+/, $line;
44 my @Fields = split /\s+/, $line, $OptMaxColumns;
46 print join($FS, @Fields).$RS;