
lony
New User
Dec 7, 2009, 8:50 PM
Post #1 of 1
(1624 views)
|
|
Need script for compare values and send error message
|
Can't Post
|
|
Hi Guys, I am new to perl...M working in PERL scripting for Informatica Projects, My Requirement belows: ====================================================== First it will search for source path for source file and control file. Once it get these files it go to next step else send a error Get source file information from control file Get in the control file whether the file size filed is 0 or not IF it is 0 byte file then send a error IF not then get the record count and file size value Matches the file size and records count values Exit ============================================================= Control file structure ABC.txt,10,200 bb.txt,20,100 ============================================================== I have made some pseudocode but dont know how to implement this,as its not working properly #!C:\Perl\bin use strict; use warnings; use Cwd; use File::Find; $mypath = "D:\Documents and Settings\Desktop"; chdir($mypath) or die "Cant chdir to $mypath $!"; system("ls -lt"); my $search_pattern=$ARGV[0]; my $file_pattern =$ARGV[1]; find(\&d, cwd); sub d { my $file = $File::Find::name; $file =~ s,/,\\,g; return unless -f $file; return unless $file =~ /$file_pattern/; open F, $file or print "couldn't open $file\n" && return; while (<F>) { if (my ($found) = m/($search_pattern)/o) { print "found $found in $file\n"; last; } } close F; } Any help will be appreciated. Thanks, Lony
|