Perl Monk, Perl Meditation | |
PerlMonks |
Re: remove lines that do not match search patternby GotToBTru (Prior) |
on Aug 04, 2015 at 13:09 UTC ( [id://1137371]=note: print w/replies, xml ) | Need Help?? |
Do you really want to remove lines that don't have a MAC address, or do you want to keep lines that do? I don't have Expect installed, so I can't test this, but looking at the documentation, it appears the $obj->expect($cmd,@params) and $obj->matchlist() contain the functionality you need. @params needs to contain a single entry, a regex that matches MAC addresses. matchlist() will return an array(?) of matching lines from the output of $cmd.
In Section
Seekers of Perl Wisdom
|
|