I am writing a Perl script that uses the grep command and instead of writing to the output file it just writes to the screen.
#!/usr/bin/perl
#
#
@ffiles = `ls CP*BUFFER*.dat`;
foreach my $file (@ffiles){
@data = split(/./, $file);
$filename = $data[0];
$extension = $data[1];
#print "$filename\n";
@newfile = split(/_/, $filename,2);
$CP = $newfile[0];
$name = $newfile[1];
#print "$name\n";
$outfile = "CF.dat";
#print "$outfile\n";
#open(OUTFILE, ">$outfile");
system("grep FL $file > output.dat ");
system("grep AFB $file >> output.dat");
system("mv output.dat $outfile");
}
Thanks to whoever can help:)