Hi Guys , I am working on one perl script to create one output file based on some data processing on my input file in a different format.

Input file

########################################### pat1 U_TOP_LOGIC/i_reg_2_/Q : # {111111}111 pat2 U_TOP_LOGIC/i_reg_2_/Q : # {110111}111 pat3 U_TOP_LOGIC/i_reg_2_/Q : # {110111}011 pat4 U_TOP_LOGIC/i_reg_2_/Q : # {110111}101 pat5 U_TOP_LOGIC/i_reg_2_/Q : # {110111}110 pat1 U_TOP_LOGIC/i_reg_3_/Q : # {111111}110 pat2 U_TOP_LOGIC/i_reg_3_/Q : # {111111}111 pat3 U_TOP_LOGIC/i_reg_3_/Q : # {111111}101 pat4 U_TOP_LOGIC/i_reg_3_/Q : # {111111}110 pat5 U_TOP_LOGIC/i_reg_3_/Q : # {111111}111 pat1 U_TOP_LOGIC/i_reg_4_/Q : # {111111}111 pat2 U_TOP_LOGIC/i_reg_4_/Q : # {111111}011 pat3 U_TOP_LOGIC/i_reg_4_/Q : # {111111}111 pat4 U_TOP_LOGIC/i_reg_4_/Q : # {111111}011 pat5 U_TOP_LOGIC/i_reg_4_/Q : # {111111}111 ################################################################

As you can see in the input file there are 5 patterns for each register .

Please find the output file which I am looking for .In this output file first section is the name of the register(should come only once) , then the patterns name pat1 pat2 pat3 pat4 and pat5 , Each of this pattern should have a value which is the first split from the section

For example {111111}111

I am just looking for the first value after finishing of curly braces.'

{111111} - dont want this

111 - 1st value from this pattern ie 1

Example : U_TOP_LOGIC/i_reg_2_/Q , The first value after the curly braces for each pattern is 1 1 0 1 1 .

Output file (First split)

######################################################## Reg pat1 pat2 pat3 pat4 pat5 ######################################################## U_TOP_LOGIC/i_reg_2_/Q 1 1 0 1 1 U_TOP_LOGIC/i_reg_3_/Q 1 1 1 1 1 U_TOP_LOGIC/i_reg_4_/Q 1 0 1 0 1 ########################################################

I am not getting exact success with perl . Could you help me out?

Thanks and Regards

Kshitij Kulshreshtha


In reply to Formatted output file with data processing by kshitij

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.