troubleshooting Question

readdir and grep

Avatar of smovva1
smovva1 asked on
PerlLinux OS Dev
13 Comments1 Solution1243 ViewsLast Modified:
In perl, I have 2 variables. One is the customer name and another is the date. And exclude . and ..

I need to get the files that match this criteria.
I am not sure how to use grep to do this..

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
my $yesterday = sprintf("%04d%02d%02d", $year+1900, $mon, $mday-1);
my $customer = "abc";

  @files = grep /$yesterday/, readdir(DIR);
         print "File count = @files\n";
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros