Hi All,
I got an project in which i need to write a parser in perl to parse any kind of text based file. Any Kind in the sense the text file may contain one single row of data or one single column of data or mix of column's of data then row of data... I am giving some samples of these text files.. Click on the below link... These text files are actually output of our test stations...
Sample1 : http://www.nopaste.com/p/an3agZH7l/txt
Sample2 : http://www.nopaste.com/p/ax4WqpfGD/txt
Sample3 : http://www.nopaste.com/p/aHILa6zCx/txt
Sample4: http://www.nopaste.com/p/az0xmELRfb/txt
The Desired Job is to process any kind of text file in any of the format (some of the files available from the above links) and then generate an xml in the below format
XML Format Link: http://www.nopaste.com/p/apWvcr6qkb/txt
As you can see the xml will have tags like FACTORY NAME, TESTER, FIXTURE, USER, DUT, STATUS e.t.c the value for these attributes have to be parsed from the text file given as input in commandline and this xml should be generated and save to one fixed folder. Once saved then i have an application which will process this xml so no problem...
So in order for the perl to parse the file my idea was to have an configuration file where we need to define which row or which column should be read and matched to the attribute of TESTER or DUT or STATUS.
The Code i have done till now is here... http://www.nopaste.com/p/ayu08nKLcb/txt
And the Configuration File for this parser is here... http://www.nopaste.com/p/a3ycFwDUM/txt
So anyone can give me an idea on how to handle these files and get the desired xml output? Is My Code correct.. Is there any good method??? Need your inputs...

In reply to Perl Parser to Handle Any File Format by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.