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

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
$ echo `hostname -i; hostname -f` 10.1.9.183 jboss-box1.domain.com

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

eth0 Link encap:Ethernet HWaddr 00:0C:29:3D:6B:CF inet addr:10.1.9.183 Bcast:10.1.9.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe3d:6bcf/64 Scope:Link Interrupt:177 Base address:0x1424 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 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.


In reply to Re: parsing system info by moritz
in thread parsing system info by 5mi11er

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2021-10-22 04:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (85 votes). Check out past polls.

    Notices?