M
mark
Hi There..
I've a perl script which amongst other things searches for text strings
in a large number of files. The problem I've got is, while the script
is running - idle cpu% drops to 0. (A mix of user and kernel usage).
The code is:
#!/usr/bin/perl
use strict;
my @files = `ls -lart /app/EV4/data/db/u* | awk '{print \$NF}'`;
foreach my $file (@files) {
chomp ($file);
(my $date) = $file =~ m/.*\.(.*)/;
my @result = `grep anicol $file`;
}
@files contains around 7800 entries. I've tried using alternatives to
grep (by opening each file and using pattern matching) but to no avail.
Sticking a 'sleep 1' in the foreach solves the problem.. but I dont
really want to wait 2 hours for the script to run.
Can anyone suggest a better way of doing the above or am I asking the
impossible?
Many thanks in advance - much appreciated,
Cheers,
Mark
I've a perl script which amongst other things searches for text strings
in a large number of files. The problem I've got is, while the script
is running - idle cpu% drops to 0. (A mix of user and kernel usage).
The code is:
#!/usr/bin/perl
use strict;
my @files = `ls -lart /app/EV4/data/db/u* | awk '{print \$NF}'`;
foreach my $file (@files) {
chomp ($file);
(my $date) = $file =~ m/.*\.(.*)/;
my @result = `grep anicol $file`;
}
@files contains around 7800 entries. I've tried using alternatives to
grep (by opening each file and using pattern matching) but to no avail.
Sticking a 'sleep 1' in the foreach solves the problem.. but I dont
really want to wait 2 hours for the script to run.
Can anyone suggest a better way of doing the above or am I asking the
impossible?
Many thanks in advance - much appreciated,
Cheers,
Mark