Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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!
  • 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, 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
  • 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [davido]: yeah, umount -f isn't powerful enough.
    [tye]: probably something in the init subsystem that does the mounting that you could disable and reboot.
    davido needs to close laptop to board flight home from yapc.
    [davido]: I'll look into it in a few hours probably.
    [davido]: when i do get to that point I think I'll do it in a vm snapshot just in case. :)
    [oiskuu]: tye, you were right: loginuid/sessionid are part of task struct if compiled with AUDITSYSCALL. I have some doubts if you should actually depend on that feature.
    [Corion]: oiskuu: Depends on what you want to do with that information
    [tye]: I'm not depending on that feature. But I could in this environment. I'm using getlogin(). shrug
    [Corion]: For benign logging (which user started this DB instance), it's OK
    [tye]: We use auditd for security monitoring. So we can rely on auditing being enabled. I'm not sure who would want to not be able to audit. Maybe some VM inside another system with audit?

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (7)
    As of 2017-06-23 20:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      How many monitors do you use while coding?















      Results (555 votes). Check out past polls.