Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: grabbing dmidecode memory data - there's got to be a better way

by kennethk (Abbot)
on Dec 28, 2012 at 19:41 UTC ( #1010738=note: print w/replies, xml ) Need Help??


in reply to Re^2: grabbing dmidecode memory data - there's got to be a better way
in thread grabbing dmidecode memory data - there's got to be a better way

You could simplify the split to \n\n+ or something similar, but then you need to modify something else to keep the records newline separated. I'm willing to go to pretty extreme lengths to keep print if /RAM socket/ && !/Not Installed/ clean just because of personal taste. TIMTOWTDI.

dmidecode | perl -e 'undef $/;/RAM socket/ && !/Not Installed/ && s/$/\n\n/ && print for split /\n\n+/, <>'


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Replies are listed 'Best First'.
Re^4: grabbing dmidecode memory data - there's got to be a better way
by Tommy (Chaplain) on Dec 28, 2012 at 19:54 UTC

    That's another good example. Less clear than your first, but still much less ugly than my original line-by-line cherry picker.

    --
    Tommy
    $ perl -MMIME::Base64 -e 'print decode_base64 "YWNlQHRvbW15YnV0bGVyLm1lCg=="'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010738]
help
Chatterbox?
[Corion]: Also, London is always a nice visit, as I got to meet a friend there, and spent some time offline, working on "minor" features of the shadertoy thing ;)
[marto]: maybe next year when the kids are a little older I'll have time to attend perl events in Europe
[Corion]: marto: Yeah - there isn't a Perl Day-Care at Perl events - we thought about it for YAPC::Europe 2012 but it's a gigantic effort to organize that
[marto]: Corion yeah, it'd be too costly for me to bring them both :P

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2016-12-07 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (125 votes). Check out past polls.