MySQL Forums
Forum List  »  Perl

perl run this program like perl name.pl path stringtofound
Posted by: tijenderpopli
Date: November 21, 2006 04:58AM

#!/bin/perl
$datadir = $ARGV[0];
$strtofind = $ARGV[1];
opendir(cldDir, "$datadir") || die "Cannot opendir $data_dir";
foreach $cldFileName (sort readdir(cldDir)) {
$temp=index($cldFileName,$strtofind);
if($temp >= 0)
{
print $cldFileName;
open(DATA_FILE_HANDLE, "<".$datadir.$cldFileName);
foreach $each_line (<DATA_FILE_HANDLE>){
# print $each_line;
}
close(DATA_FILE_HANDLE);
}
}



Edited 1 time(s). Last edit at 11/21/2006 07:29AM by tijenderpopli.

Options: ReplyQuote


Subject
Written By
Posted
perl run this program like perl name.pl path stringtofound
November 21, 2006 04:58AM
November 21, 2006 07:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.