Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

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

Hi all,

i have a text file that contains the following lines

High fanout nets in the post compile netlist: Fanout Type Name -------------------------- 2 INT_NET Net : c_c Driver: c_pad 2 INT_NET Net : b_c Driver: b_pad 2 INT_NET Net : a_c Driver: a_pad 1 INT_NET Net : sum_c Driver: sum_1_SUM0_0 1 INT_NET Net : N_5 Driver: sum_1_CO0_i

I have to write a perl script that saves the following statements only, i.e. high fanout nets alone. For that, if i write a script which find maximum number in my text file and copies those statements in new file, it will copy the following statements.

2 INT_NET Net : c_c 2 INT_NET Net : b_c 2 INT_NET Net : a_c

Here is the code i tried, but could not get the text file as i wish....

my $high_number = 0; open (F1, "<new.txt") or die "cant open it$!"; while (<F1>) { my ($number) = m/:(\d+):/; $high_number = $number if $number > $high_number; } print "Highest number found = $high_number\n"; close (F1);

please help me out in this, thank you all....


In reply to Find maximum number in text file and copying its full statement in new text file? by sumathigokul

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 browsing the Monastery: (3)
As of 2024-04-19 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found