Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: collect, set, and analyze command outputs

by rjt (Curate)
on Oct 04, 2019 at 19:17 UTC ( #11107065=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    my   @lines = `list cm device all-properties`;
    my @matches = grep { /configsync-ip/ } @lines;
    chomp @matches; # Remove trailing newlines
  2. or download this
    my @matches = grep { /configsync-ip/ } `list cm device all-properties`
    chomp @matches;
  3. or download this
    for (@matches) {
        my (undef, $ip) = split /\s+/;
        ... # Your code to deal with the IP here.
  4. or download this
    my @ips = map { (split /\s+/)[1] } 
             grep { /configsync-ip/ } `list cm device all-properties`;
  5. or download this
    use List::MoreUtils qw/:all/;
        # $addr is the first line, e.g.:  address
        # $allow_service is the 2nd line:   allow-service all 

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2020-06-02 06:13 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (13 votes). Check out past polls.