Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: sending hundreds of commandos on SSH connection

by hazylife (Monk)
on Mar 28, 2014 at 16:30 UTC ( [id://1080112]=note: print w/replies, xml ) Need Help??


in reply to sending hundreds of commandos on SSH connection

grep -E ' 900 ' | grep -v 1900 | grep -E -v '0 RE' | grep -E -v '0 WE' | grep -E -v '0 WAV' | grep -E -v '0 WA' | awk '{print \$3\";\", \$6\";\" }'");

That's an awful lot of greps, and they're all of the same "fixed-string"/-F variety. You could probably reduce the above to something like:

my @ls = $ssh2convey99->capture(q/disptest | fgrep ' 900 ' | fgrep -v +1900 | grep -vE '0 ([RW]E|WA)' | awk '{print $3";", $6";" }'/);

...or replace the whole grep-awk chain with a Perl script!

perl -nle 'next if !/ 900 /||/1900/||/0 ([RW]E|WA)/; my @f = split; print "$f[2]; $f[5];"'

update: "0 WA" already takes care of "0 WAV"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1080112]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-25 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found