Perl-Thornton has asked for the wisdom of the Perl Monks concerning the following question:
Hello all. I have a file that looks like this:
The repeating pattern seems obvious. Each row starts with either text that starts at the beginning of the row (i.e. hostname which could be the key to a hash), or the row starts with white space or tabs and then some text which could be the values associated with the key of the hash (i.e. serial number, interface, etc..). I have been working on solving this to parse through files with a Perl program but I've failed so far. I was hoping the Perl community might have suggestions to help me grasp what seems like should be a simple concept.Hostname1 1.1.1.1 Cisco Chassis Serial Number xyz123 Interface Gig0/0/31 Hostname2 2.2.2.2 Juniper Chassis Serial Number abc123 Interface Gi-0/0/31
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Create based on repeating data
by BrowserUk (Patriarch) on Aug 24, 2016 at 00:57 UTC | |
by NetWallah (Canon) on Aug 24, 2016 at 03:21 UTC | |
|
Re: Create based on repeating data
by GrandFather (Saint) on Aug 24, 2016 at 01:23 UTC | |
|
Re: Create based on repeating data
by perldigious (Priest) on Aug 24, 2016 at 00:42 UTC |