Project

General

Profile

Configuration ยป join.pl

Perl script to join the dect-transceiver-list output of multiple transceivers - laforge, 01/02/2022 04:10 PM

 
1
#! /usr/bin/perl -w
2
#
3

    
4
my $res = {};
5
my $lines = 0;
6

    
7
foreach 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

    
20
for (my $i = 0; $i < $lines; $i++) {
21
	foreach my $trx ( @ARGV ) {
22
		printf("%-80s", $res->{$trx}->[$i]);
23
	}
24
	printf("\n");
25
}
    (1-1/1)
    Add picture from clipboard (Maximum size: 48.8 MB)