P is for Practical | |
PerlMonks |
Re: Need help to parse the textby tachyon (Chancellor) |
on Jun 17, 2004 at 04:29 UTC ( [id://367528]=note: print w/replies, xml ) | Need Help?? |
Your first problem is that the format of ifconfig -a may be different on different platforms. For example:
Anyway you need to find a good way to chunkify the data into records. Assuming you get it in a scalar split "\n\n" should probably do the trick. Then the first string in your chunk is the interface name and m/status:\s+(\S+)/ will give your status. That won't work on Linux.
cheers tachyon
In Section
Seekers of Perl Wisdom
|
|