Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > What does 'grep -M' do?

Reply
Thread Tools

What does 'grep -M' do?

 
 
grocery_stocker
Guest
Posts: n/a
 
      04-15-2007
The following code is taken from
http://groups.google.com/group/perl....fffccf/?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

 
Reply With Quote
 
 
 
 
John W. Krahn
Guest
Posts: n/a
 
      04-15-2007
grocery_stocker wrote:
> The following code is taken from
> http://groups.google.com/group/perl....fffccf/?hl=en#


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

> -M do?


perldoc -f -M




John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      04-15-2007
grocery_stocker wrote:

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


perldoc -f -M

jue


 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      04-15-2007
grocery_stocker <(E-Mail Removed)> wrote:


> What does grep -M do?



perldoc -f grep

perldoc -f -M


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET 2.0 ASPx Page does not load, but HTM does prabhupr@hotmail.com ASP .Net 1 02-08-2006 12:57 PM
Button OnClick does not fire on first postback, but does on second Janet Collins ASP .Net 0 01-13-2006 10:08 PM
Does the 2.0 Framework come out when Visual Studio .NET 2005 does? needin4mation@gmail.com ASP .Net 3 10-07-2005 12:55 AM
CS0234 Global does not exist ... but it genuinely does Bill Johnson ASP .Net 0 07-08-2005 06:34 PM
Does no one else think microsoft does a poor job? =?Utf-8?B?SmVyZW15IEx1bmRncmVu?= Wireless Networking 2 11-20-2004 12:17 AM



Advertisments