Hi All ,

I would require your help to generate one output file after post processing of one CSV file as stated below

This file is just a small cut from a big file . Big file is having 20000 lines

PATTERN,pat0,pat1,pat2,pat3,pat4,pat5,pat6,pat7,pat8,pat9 U_TOP_LOGIC/ipre_reg_0/Q,0,0,1,1,0,0,1,1,0,0 U_TOP_LOGIC/ipre_reg_6/Q,1,1,0,0,1,1,0,0,1,1 U_TOP_LOGIC/pre_reck_1/Q,1,1,0,1,1,0,0,1,1,0 U_TOP_LOGIC/pre_reg_10/Q,0,1,0,1,1,0,0,1,1,1 U_TOP_LOGIC/pre_reg_11/Q,0,0,1,0,1,0,0,1,0,1

Now , I need to create one output file in which whenever the transition is happening from "0" to "1" or "1" to "0" , the destination pattern should be provided weight 0.25 in an incremental order and the end I need to sum the weight of each pattern

For example , this is the pattern U_TOP_LOGIC/ipre_reg_0/Q,0,0,1,1,0,0,1,1,0,0

pat0 is "0" , pat1 -> "0" , pat2 > "1" , pat3 -> "1" , pat4 -> "0" , pat5 -> "0" , pat6 -> 1 , pat7 -> 1 , pat8 -> 0 , pat9 -> 0

Now when the transition is happening from "0" to "1" , for example it is happening for pat1 to pat2 pattern , pat2 is assigned "0.5" weight , similarly when the transition is happening from "1" to "0" , for example it is happening from pat3 and pat4 then 0.5 is assigned for pat4 ,

This should be the sequence for U_TOP_LOGIC/ipre_reg_0

pat2 -> 0.5 pat 4 -> 0.5 pat6 -> 0.5 pat8 -> 0.5

Output file is like this for all the patterns

Number pat0 pat1 pat2 pat3 pat4 pat5 pat6 pat7 pat8 +pat9 U_TOP_LOGIC/ipre_reg_0/Q 0 0 0.5 0 0.5 0 0.5 0 0.5 + 0 U_TOP_LOGIC/ipre_reg_6/Q 0 0 0.5 0 0.5 0 0.5 0 0.5 + 0 U_TOP_LOGIC/pre_reck_1/Q 0 0 0.5 0.5 0 0.5 0 0.5 0 + 0.5 U_TOP_LOGIC/pre_reg_10/Q 0 0.5 0.5 0.5 0 0.5 0 0.5 0 + 0 U_TOP_LOGIC/pre_reg_11/Q 0 0 0.5 0.5 0.5 0.5 0 0.5 0.5 + 0.5 ###################################################################### +######## SUM Of weights 0 0.5 2.5 1.5 1.5 1.5 1 1.5 1.5 + 1.5 ###################################################################### +########

In reply to Perl script for the post processing of one CSV file 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.