Hello,
I am trying to use the length function to determine the length of the input string and then print it if it is 1313 long. Else just skip it. This is what I have so far. I am not sure what I am doing wrong. Any help would be great.
#!/bin/ksh/perl -w
use strict;
##Open file for reading records##
my $file = '/u02/35bad.dat';
open (INPUTFILE, $file)
or die "could not open the $file $!\n";
##Open new outputfile##
my $out_file = '/u02/35_new_file';
open (OUTPUTFILE,">$out_file"
or die "could not open the $out_file $!\n";
my $line;
while ($line=<INPUTFILE>){
chomp($line);
while (length($line) == 1313){
print OUTPUTFILE $line;
}
}
close (INPUTFILE);
close (OUTPUTFILE);
Currently I am ending up a with a new file created, but it is 0 bytes. Can someone help me figure this out?
Thanks,
Geek.
I am trying to use the length function to determine the length of the input string and then print it if it is 1313 long. Else just skip it. This is what I have so far. I am not sure what I am doing wrong. Any help would be great.
#!/bin/ksh/perl -w
use strict;
##Open file for reading records##
my $file = '/u02/35bad.dat';
open (INPUTFILE, $file)
or die "could not open the $file $!\n";
##Open new outputfile##
my $out_file = '/u02/35_new_file';
open (OUTPUTFILE,">$out_file"
or die "could not open the $out_file $!\n";
my $line;
while ($line=<INPUTFILE>){
chomp($line);
while (length($line) == 1313){
print OUTPUTFILE $line;
}
}
close (INPUTFILE);
close (OUTPUTFILE);
Currently I am ending up a with a new file created, but it is 0 bytes. Can someone help me figure this out?
Thanks,
Geek.