pomoc s rozparsovanim

Vaclav Petricek vaclav.petricek at mff.cuni.cz
Tue Jun 24 21:26:14 CEST 2003


Je treba escapnout ty dolary:

------------------------------------------------------------------------
my $iface = 'wi0';

# get wireless link details
my $snr = `wicontrol $iface|grep "dBm Coms Quality"|awk '{print \$5}'`;
my $signal = `wicontrol $iface|grep "dBm Coms Quality"|awk '{print \$6}'`;
my $noise = `wicontrol $iface|grep "dBm Coms Quality"|awk '{print \$7}'`;
my $rate = `wicontrol $iface|grep "Tx rate (actual speed)"|awk '{print
\$6}'`;

# remove eol chars
chomp($snr);
chomp($signal);
chomp($noise);
chomp($rate);

print "$iface link stats: snr: $snr dB, signal: $signal dBm, noise: $noise
dBm, rate: $rate Mbits/s\n";
------------------------------------------------------------------------

Venca

> Ahoj,
> nedari semi prijit na to, kde mam chybu... :-( Jakoby nefungovalo
> posledni omezeni s awk, do jednotlivych promenych potrebuju ciselne
> hodnoty. Dik za jakoukoli radu.
>
> my $iface = 'wi0';
>
> # get wireless link details
> my $snr = `wicontrol $iface|grep "dBm Coms Quality"|awk '{print $5}'`;
> my $signal = `wicontrol $iface|grep "dBm Coms Quality"|awk '{print
> $6}'`;
> my $noise = `wicontrol $iface|grep "dBm Coms Quality"|awk '{print $7}'`;
> my $rate = `wicontrol $iface|grep "Tx rate (actual speed)"|awk '{print
> $6}'`;
>
> # remove eol chars
> chomp($snr);
> chomp($signal);
> chomp($noise);
> chomp($rate);
>
> print "$iface link stats: snr: $snr dB, signal: $signal dBm, noise:
> $noise dBm, rate: $rate Mbits/s\n";
>
> Milan
>
>
>



More information about the Users-l mailing list