USAGE: perl "script file" "word to grep" "file name where you going to perform the action"
#!/usr/bin/perl
$word=$ARGV[0];
$file=$ARGV[1];
open(FILE,"$file");
while($line=<FILE>)
{
if($line=~/\b$word\b/ )
{
print $line."\n";
}
}
close(FILE);
#!/usr/bin/perl
$word=$ARGV[0];
$file=$ARGV[1];
open(FILE,"$file");
while($line=<FILE>)
{
if($line=~/\b$word\b/ )
{
print $line."\n";
}
}
close(FILE);
No comments:
Post a Comment