dr014578 has asked for the wisdom of the Perl Monks concerning the following question:
Thank you to everyone for your information/guidance. I was able to get the data successfully put into a hash and got the Text::Table output to work also. Now if i can complicate it a bit more, within the same column after the nickname there is a list of disks associated with each host and there could be multiples for each one (i updated input file below to show example). Sorry i didn't put this in originally but i'm taking baby steps. Is it possible to do this in one hash? should i put the disk info into an array somehow and create a reference to that array in the hash table or should i try and split this into two hashs and possbily join them by unique key?. Thanks again.
I'm looking to parse a single column text file and split repeating data in that file into record/table format for output. Below is a sample of the input file and what I'd like to see for the output. I'm not looking for sample code just some direction to which perldoc i should be reading to get me started. Thank you.
<input file>
portID=0
portName=1A
domainID=0
hostMode=Standard
nickname=host1
disk=00:81
disk=00:79
disk=01:34
portID=0
portName=1A
domainID=1
hostMode=AIX
nickname=host2
portID=0
portName=1A
domainID=10
hostMode=HP
nickname=host3
<output>
PortID PortName DomainID HostMode Nickname
0 1A 0 Standard host1
0 1A 1 AIX host2
0 1A 10 HP host3
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Text File Parsing
by umasuresh (Hermit) on Nov 24, 2010 at 17:06 UTC | |
|
Re: Text File Parsing
by biohisham (Priest) on Nov 24, 2010 at 18:12 UTC | |
|
Re: Text File Parsing
by locked_user sundialsvc4 (Abbot) on Nov 24, 2010 at 19:21 UTC | |
by mjscott2702 (Pilgrim) on Nov 25, 2010 at 10:25 UTC | |
|
Re: Text File Parsing
by Anonymous Monk on Nov 24, 2010 at 17:36 UTC |