Configuration: join.pl

File join.pl, 412 bytes (added by kaber, 7 years ago)

Perl script to join the dect-transceiver-list output of multiple transceivers

Line 
1#! /usr/bin/perl -w
2#
3
4my $res = {};
5my $lines = 0;
6
7foreach my $trx ( @ARGV ) {
8        open(FD, "dect-transceiver-list --name $trx |") || die ("list");
9        my $n = 0;
10        while ( my $line = <FD> ) {
11                chomp($line);
12                push @{$res->{$trx}}, $line;
13                $n++;
14        }
15        if ($n > $lines) {
16                $lines = $n;
17        }
18}
19
20for (my $i = 0; $i < $lines; $i++) {
21        foreach my $trx ( @ARGV ) {
22                printf("%-80s", $res->{$trx}->[$i]);
23        }
24        printf("\n");
25}