Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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":



  • 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? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2023-09-28 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?