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