MOOST IMPORTANT:
Use Unix file format while saving Your script.
otherwise it will have ^M s or smth likely weird in the EOL,
Then DO NOT use my adhoc intialization in Unix like my $list = ...;
,never worked,doesn't seem to work now,why bother,
just
compare 2 snpips bellow:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: | #!/usr/bin/perl
use Win32::ODBC;
use File::Find;
#@ARGV = ('.') unless @ARGV;
$path = "/stage001/TgtFiles/CMR/";
#my $filesize = 0;
$path = "c:\\DATA\\FTP\\" ;
$ret = 1;
$i = 1;
$file = "LOSEOUT_DTL.txt";
$trg = 655;
if (@ARGV ne ("")) {
$file = shift @ARGV;
}
# if (&checks) { system 'gen_geo_files.ksh $file NN' }
&checks;
sub checks(){
# my path = "/ushhetl/stage001/TgtFiles/CMR/"
open (DATAFILE, $path.$file)
or die ("Problem opening file: $!");
while (defined ($line = <DATAFILE>)) {
chomp $line;
$size = length $line;
if ($i==1) {$trg=($size-1); }
if ( $size<$trg) {
print "$i:$size:$file:$ret" ;
print "$line\n";
$ret ;
}
$i ;
# if ($i>0) { return $ret; }
# output size of line
}
# $filesize = -s $file;
print "\n$file:$i:$trg";
#if ($i>0) {
return $ret;
#}
}
#while (<SPREADSHEET>) {
# $numbers = $_;
# chomp($numbers);
# @numbers = split(/\t/, $numbers);
# $total = 0;
# foreach $number (@numbers){
# $total = $total $number;
# }
# print $total . "\n";
#}
#close (SPREADSHEET); |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: | for Unix:
#!.perl
#use Win32::ODBC;
#use File::Find;
#@ARGV = ('.') unless @ARGV;
$path = "/stage001/TgtFiles/r/";
#my $filesize = 0;
# my $path = "c:\\DATA\\FTP\\" ;
my $ret = 1;
my $i = 1;
$file = "_DTL.txt";
my $trg = 655;
if (@ARGV ne ("")) {
$file = shift @ARGV;
}
# else { $file = "CLOSEOUT_DTL.txt"; $trg = 655; }
# find(\&checks, $path);
# if (&checks) { system 'gen_geo_files.ksh $file NN' }
&checks;
sub checks(){
# my path = "/ushhetl/stage001/TgtFiles/CMR/"
open (DATAFILE, $path.$file)
or die ("Problem opening file: $!");
while (defined ($line = <DATAFILE>)) {
chomp $line;
$size = length $line;
if ($i==1) {$trg=($size-1); }
if ( $size<$trg) {
print "$i:$size:$file:$ret" ;
print "$line\n";
$ret ;
}
$i ;
# if ($i>0) { return $ret; }
# output size of line
}
# $filesize = -s $file;
print "\n$file:$i:$trg";
#if ($i>0) {
return $ret;
#}
}
#while (<SPREADSHEET>) {
# $numbers = $_;
# chomp($numbers);
# @numbers = split(/\t/, $numbers);
# $total = 0;
# foreach $number (@numbers){
# $total = $total $number;
# }
# print $total . "\n";
#}
#close (SPREADSHEET); |