Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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



In reply to Text File Parsing by dr014578

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-24 01:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found