Jun 30, 2010, 12:11 PM
Post #1 of 6
hi guys i have this program which works fine with one text file .. but i wana enhance this program so i could use it to access multiple text files at one .. any suggestion .. how may i do that
#Asks the user for the input files
print "What file would you like GERP to look in,[DO NOT DRAG THE FILE COPY AND PASTE THE PATH]: ";
chomp ($gfile = <>);
print "What would you like to the call the new file: ";
chomp ($filename= <>);
#opens up the File that grep has to look into.
#open (my $fh, '<', "C:/Documents and Settings/ochoudhry/Desktop/-New gps/For BlackBerry Testing/grep/gl-Factory_Low_SNR-test-2010-05-31-112613-001.txt");
open (my $fh, '<', $gfile);
#Uses grep to find FTS in the file specified by the user.
my @file = @fts = grep(/FTS/, <$fh>);
#opens up and excel sheet and paste the data that grep has gathered in the step above
sysopen (GREP, $filename, O_RDWR|O_EXCL|O_CREAT, 0755);
print GREP @fts;