Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: split file on blank lines and match blocks

by BrowserUk (Pope)
on Sep 09, 2012 at 03:29 UTC ( #992554=note: print w/ replies, xml ) Need Help??

in reply to split file on blank lines and match blocks

trying to identify hosts that are members of the CRIT hostgroup, or of the DMZ hostgroup

Ignoring that your text say's that, and your code 'GRID|RMAN', this might set you on your road:

#! perl -slw use strict; $/ = ''; ## para model see perldoc -q paragraphs m[ (?=^.*(DMZ|CRIT)) (?=^.*host_name\s+(\S+)) (?=^.*address\s+(\S+)) ]sx and print "$2 [$3] is a member of $1" while <DATA>; __DATA__ [snip... your sample data here]


C:\test>junk denlas02 [] is a member of DMZ ppplas12 [] is a member of CRIT

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong

Comment on Re: split file on blank lines and match blocks
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2015-11-25 19:29 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (686 votes), past polls