What does 'grep -M' do?

G

grocery_stocker

The following code is taken from
http://groups.google.com/group/perl.beginners/browse_thread/thread/c1b0afccf5fffccf/?hl=en#

# open the current directory
opendir my $dh, '.' or die "Cannot open '.' $!";

# get files older than three days
my @files = grep -M > 3, readdir $dh;

closedir $dh;

for my $file ( @files ) {
rename $file, "history/$file" or die "Cannot move '$file' $!";
}


What does grep -M do? Is this a perl option for grep? I don't see this
option when I look up grep on the unix man pages. I tried searching
google and found nothing.

Chad
 
J

John W. Krahn

grocery_stocker said:

Since I posted that I guess I should answer. :)
# open the current directory
opendir my $dh, '.' or die "Cannot open '.' $!";

# get files older than three days
my @files = grep -M > 3, readdir $dh;

closedir $dh;

for my $file ( @files ) {
rename $file, "history/$file" or die "Cannot move '$file' $!";
}


What does grep

perldoc -f grep

perldoc -f -M




John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top