go ahead... be a heretic PerlMonks

### Re^2: Telnet Output

by jmutton (Initiate)
 on Jan 01, 2014 at 21:19 UTC ( #1068874=note: print w/replies, xml ) Need Help??

in reply to Re: Telnet Output

Thanks for the reply. How would it work if I had multiple SNRs? For examples
```SNR Margin    60    60    (US0,--) 0.1 dB
SNR Margin    61    53    (US1,DS1) 0.1 dB
SNR Margin    62    50    (US2,DS2) 0.1 dB
SNR Margin    0    N/A    (US3,DS3) 0.1 dB
SNR Margin    0    N/A    (US4,DS4) 0.1 dB

Replies are listed 'Best First'.
Re^3: Telnet Output
by jmutton (Initiate) on Jan 01, 2014 at 22:46 UTC
```my %snr;
while ( my \$line = shift @lines ) {
chomp \$line;
# (US0,--) 0.1 dB
if ( \$line =~ m/SNR Margin:\s*(\d+)\s+(\d+)\s*\(US0,--\) 0.1 dB/ )
+ {
( \$snr{us0} ) = ( \$1 );
}
# (US1,DS1) 0.1 dB
if ( \$line =~ m/SNR Margin:\s*(\d+)\s+(\d+)\s*\(US1,DS1\) 0.1 dB/
+) {
( \$snr{us1}, \$snr{ds1} ) = ( \$1, \$2 );
}
# (US2,DS2) 0.1 dB
if ( \$line =~ m/SNR Margin:\s*(\d+)\s+(\d+)\s*\(US2,DS2\) 0.1 dB/
+) {
( \$snr{us2}, \$snr{ds2} ) = ( \$1, \$2 );
}
# (US3,DS3) 0.1 dB
if ( \$line =~ m/SNR Margin:\s*(\d+)\s+(\d+)\s*\(US3,DS3\) 0.1 dB/
+) {
( \$snr{us3}, \$snr{ds3} ) = ( \$1, \$2 );
}
# (US4,DS4) 0.1 dB
if ( \$line =~ m/SNR Margin:\s*(\d+)\s+(\d+)\s*\(US4,DS4\) 0.1 dB/
+) {
( \$snr{us4}, \$snr{ds4} ) = ( \$1, \$2 );
}
}

print q{US0:}, \$snr{us0}, qq{\n};
print q{US1:}, \$snr{us1}, q{ }, q{DS1:}, \$snr{ds1}, qq{\n};
print q{US2:}, \$snr{us2}, q{ }, q{DS2:}, \$snr{ds2}, qq{\n};
print q{US3:}, \$snr{us3}, q{ }, q{DS3:}, \$snr{ds3}, qq{\n};
print q{US4:}, \$snr{us4}, q{ }, q{DS4:}, \$snr{ds4}, qq{\n};
Thats what I've managed to come up with. But I need some sort of checking as some of the SNRs will report 0 or N/A. Need it to report 0 instead of N/A.

Create A New User
Node Status?
node history
Node Type: note [id://1068874]
help
Chatterbox?
 [Corion]: Sadly I must go to bed now :-| See y'all! [erix]: I really loved/love this "Recorded Live" record, 1973 (yes, I'm that old) [stonecolddevin]: goodnight Corion [erix]: cya Corion :) [stevieb]: Joan Jett, Hendrix, Neil Young, Dave Keuning (The Killers)... I have my mind elsewhere so I'm limited in my capacity to think about this righ tnow ;) [stonecolddevin]: I will say John Mayer is an excellent guitarist, I don't like his music but he's pretty damn good [erix]: scd: maybe you like John Mayall better :) [erix]: (mayall = british blues)

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-06-22 21:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
How many monitors do you use while coding?

Results (531 votes). Check out past polls.