Ruby Grep

Ruby Grep

rubyGrep.rb

Imagine this scenario: You have hundreds of files in multiple directories stored on your hard drive—all of which are important and contain information related to a research project. As you're consolidating your final report, you remember reading a figure from one of the papers, but you're not sure which paper, much less which folder, it is in. What to do? Read through the files again? Yeah, right! The first thing to do is not worry! The second thing to do is get a copy of this script and run it. This script will allow you to automatically open files and read the contents, pinpointing the information you need with lightning speed.

The Code

 require 'English'
 unless ARGV[0] puts "\nYou need to include a value to search ...

Get Wicked Cool Ruby Scripts now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.