[Buffalo-pm] Asterisk Wildcard When Running Command via Exec...

DANIEL MAGNUSZEWSKI dmagnuszewski at mandtbank.com
Thu Jul 6 11:34:01 PDT 2006


Mongers,

I am trying to grep from multiple files, named: messages, messages.0,
messages.1, messages.2, etc. What I'd like to do is grep through all of
these at once. The command to do this is: 

grep <wordToFind> /var/adm/messages*

So what I've tried doing is the following:

my $wordToFind = 'router1';
open (PROGRAM, "-|")  or exec ("/bin/grep", "$wordToFind",
"/var/adm/messages*");

The asterisk seems to break, and I get no information. When I remove
the asterisk:

my $wordToFind = 'router1';
open (PROGRAM, "-|")  or exec ("/bin/grep", "$wordToFind",
"/var/adm/messages");

...then everything works fine, but only greps through that one file.
How can I declare a wildcard within this code - if at all?

Thanks.

-Dan



More information about the Buffalo-pm mailing list