Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > A directory "grep" in RUBY?

Reply
Thread Tools

A directory "grep" in RUBY?

 
 
Peter Bailey
Guest
Posts: n/a
 
      11-27-2006
Robert Klemme wrote:
> On 24.11.2006 15:38, Peter Bailey wrote:
>> Hi,
>> Can someone point me to a quick "grep" like function in RUBY? I use glob
>> all the time, but, I need the power of regular expressions when finding
>> particular files in directories. I see "grep" in the Pickaxe manual,
>> but, only as it relates to ".enum," which, sorry to say, I don't
>> understand.
>>
>> I need something like this, even though, I know this doesn't work:
>> Dir.glob(/^f[0-9]{7}\.eps/)

>
> Dir.glob('f*.eps').grep(/^f[0-9]{7}\.eps$/)
>
> There's plenty more options around.
>
> robert


Grepping on a glob. That makes sense. I knew that grep could be used
somehow. Thanks, Robert.

--
Posted via http://www.ruby-forum.com/.

 
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
System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() are not returning the specified directory Nathan Sokalski ASP .Net 2 09-06-2007 03:58 PM
Session is lost if a directory is created under virtual directory Jack Wright ASP .Net 1 04-19-2005 03:04 PM
Directory and files names in temporary asp.net directory =?Utf-8?B?QmFzIEhlbmRyaWtz?= ASP .Net 5 01-31-2005 01:56 PM
list all css files in a directory and sub directory TJS ASP .Net 1 06-23-2004 10:49 AM
question regarding overriding of web.config in the root directory..in a web app in a virtual directory dotnetprogram ASP .Net 1 12-27-2003 06:02 AM



Advertisments