Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992554]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2018-05-23 02:00 GMT
Find Nodes?
    Voting Booth?