I am writing script to search data from around 400 files. I need all the details like in each file how many times that pattern present. I have around 8000 paterns which I need to search each in all 400 files. currently I am using grep command in scriot which makes the performance down. Now I am thinking to use multithreading here..but I am totally newbee for this..could you please help me on getting correct solution
Here is my current code
while(@data = $sth->fetchrow_array())
{
$result = `grep -i -w -c "$data[0]" /u05/oracle/R12COE/spotli
+ghter/Search_Files/Forms/*`;
@search = split('\n',$result);
$arrsize = @search;
for($i = 0; $i < $arrsize; $i++)
{
($path, $count) = split(':',$search[$i]);
($filename, $fextn) = split('\.',$path);
$filename = `basename $path`;
#$fextn = `echo $fname | sed 's/.*\.//'`;
#$fname = `echo $path | perl -pe 's|.*/||'`;
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.