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 Thanks a lot for your reply...I never thought that Perl monks really helps in this way.. Provided details really helped me a lot to improve on performance. I am sending you the updated code Please do have a look and let me know..Is this ok..or do I can still improve it

#! /usr/perl use DBI; use warnings; use strict; my $dbh = DBI->connect('DBI:Oracle:R12COE','apps','app5vis') or die "c +ouldn't connect to database: " . DBI->errstr; my $sth = $dbh->prepare("SELECT DISTINCT UPPER(OBJECT_NAME) FROM CG_CO +MPARATIVE_MATRIX_TAB WHERE OBJECT_NAME IS NOT NULL ORDER BY 1 ASC") o +r die "couldn't pr epare statement: " . $dbh->errstr; $dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; $dbh->{ora_check_sql} = 0; $dbh->{RowCacheSize} = 16; my $sth1; my $count = 0; my $i = 0; my $path = ""; my $result; my @search; my $arrsize; my $filename; my $fextn; my @files; my $dir; my $file; my $fh; my $ext = ""; my $j = 0; my @data; $sth->execute; my @obj_name; my $obj_name; while(@data = $sth->fetchrow_array()) { $obj_name[$j]= $data[0]; $j++; } $dir = '/u05/oracle/R12COE/spotlighter/Search_Files/Forms'; opendir(DIR,$dir)or die $!; @files = grep{-f "$dir/$_"} readdir(DIR); # $result = `grep -i -w -c "$data[0]" /u05/oracle/R12COE/spotli +ghter/Search_Files/Forms/*`; foreach $file (@files) { open $fh,"< $file" or die "couldn't open $file:$!"; { for $obj_name(@obj_name) { ($ext) = $file =~ /(\.[^.]+)$/; #printf "%s has %d matches for pattern + /%s/\n",$file,scalar(grep /$obj_name/, <$fh>),$obj_name; $count = scalar(grep /$obj_name/, <$fh +>); $sth1 = $dbh->prepare("INSERT INTO CUS +TOM_FILES_SUMMARY(FILE_NAME,FILE_TYPE,DEP_OBJECT_NAME,OCCURANCE)VALUE +S('$file','$ext',' $obj_name',$count)") or die "couldn't insert statement: " . $dbh->errs +tr; $sth1->execute; } } close $fh; } $sth->finish; $sth1->finish; $dbh->disconnect;

In reply to Re^3: Searching pattern in 400 files and getting count out of each file by Rita_G
in thread Searching pattern in 400 files and getting count out of each file by Rita_G

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (7)
    As of 2014-08-28 00:37 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (253 votes), past polls