Hi all,
Can any one tell me how to parse all the files (*.txt ,*.xml etc) in a folder by taking the folder name as argument and to search for a particular word in that files , I want to write a perl scipt for this, pls give me some pointers.
Regards,
Anoop4real
|
Team Leader
|
![]() |
| 25Apr2007,14:50 | #2 |
|
You want the directory listing?
|
|
Go4Expert Member
|
|
| 25Feb2010,15:51 | #3 |
|
Dear Friend,
The following coding is used to give your requirement Code:
use strict;
use warnings;
use Data::Dumper;
my $var;
foreach(@ARGV)
{
opendir(DIR,$_);
my @array=readdir(DIR);
foreach(@array)
{
$var=$_;
if($var=~/(\.txt|\.xml)/)
{
system("grep -lh 'welcome' $var");
}
}
}
|
|
Go4Expert Member
|
|
| 25Feb2010,15:59 | #4 |
|
Mr.Murugaperumal Why you are posting same answer twice?
Before Submit your answer see your Preview Image |

