in reply to Re^3: pattern search in all the files in a directory
in thread pattern search in all the files in a directory
I tried like the below and I got the solution that I desired. Can you please tell me if it can be further optimized or is enough to get proceed further? Thanks
find(\&do_process, "$dirname" ); sub do_process { chomp($_); if (-r "$_"){ $file_name = $_; open (my $fh,"< $file_name"); while(<$fh>) { chomp(); if (/\bkeyword : Multinode\b/i) { $KeyMnode = "$file_name:$_"; } if (/\bkeyword : Threads\b/i) { $KeyThreads = "$file_name:$_"; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: pattern search in all the files in a directory
by 2teez (Vicar) on Feb 19, 2013 at 14:33 UTC |