Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: parsing system info

by moritz (Cardinal)
on May 27, 2008 at 16:26 UTC ( #688683=note: print w/replies, xml ) Need Help??

in reply to parsing system info

$ echo `hostname -i; hostname -f`

Either run them separately, or split the output at whitespaces.

eth0 Link encap:Ethernet HWaddr 00:0C:29:3D:6B:CF inet addr: Bcast: Mask: inet6 addr: fe80::20c:29ff:fe3d:6bcf/64 Scope:Link Interrupt:177 Base address:0x1424 lo Link encap:Local Loopback inet addr: Mask: inet6 addr: ::1/128 Scope:Host

The interface name is simply m/^(\w+)/, What other informations do you want to extract?

$ uname -a Linux jboss-box1 2.6.9-67.0.7.ELsmp #1 SMP Sat Mar 15 06:54:55 EDT 200 +8 i686 i686 i386 GNU/Linux

Run uname several time with more specific options

And so on - there's not one all-empowering parsing paradigm - just chose what you see fit. For fixed width records you could use unpack btw - see perlpacktut.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2021-10-24 17:54 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (89 votes). Check out past polls.