Welcome to the Monastery | |
PerlMonks |
Re: Process netgroup file with a regexby Velaki (Chaplain) |
on Aug 23, 2006 at 16:57 UTC ( [id://569130]=note: print w/replies, xml ) | Need Help?? |
The trick is taking into account the possibility of a circular reference in the source data, since netgroups may overlap and nest in many, many ways. Pulling the data into a structure with a regex isn't as hard and deciding what kind of tree to use, and even more importantly, how you wish to represent the tree in a flat file format. Remember, you have a netgroup alias that maps to a collection of triples, which represent a host, a user, and a domain. Also, you may nest netgroups within netgroup definitions. I don't know what data structure you want, but maybe this snippet will help with starting to parse the file.
Hope this helped a little, Update:Change code snippet to extract the data closer to what you want. Here's the output.
"Perl. There is no substitute."
In Section
Seekers of Perl Wisdom
|
|