7 td-rename - Rename tabular data columns
11 td-rename I<OLDNAME> I<NEWNAME> [I<OLDNAME> I<NEWNAME> [I<OLDNAME> I<NEWNAME> [...]]]
15 conntrack -L | sd '^(\S+)\s+(\S+)\s+(\S+)' 'protoname=$1 protonum=$2 timeout=$3' | kvpairs2td | td-rename _REST FLAGS
19 Not to confuse with rename.td(1) which renames files, not columns.
23 no if ($] >= 5.018), 'warnings' => 'experimental::smartmatch';
24 do '/usr/lib/tool/perl5/tabdata/common.pl' or die "$@";
27 process_header
(scalar <STDIN
>);
32 for my $oldname (keys %renames)
35 for my $colidx (0..$#Header)
37 if($Header[$colidx] eq $oldname)
39 my $newname = $renames{$oldname};
40 $Header[$colidx] = $newname;
41 delete $Header{$oldname};
42 $Header{$newname} = $colidx;
48 print join($FS, @Header).$RS;