How do I add grep into this ruby script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How do I add grep into this ruby script?
# 1  
Old 09-22-2010
Data How do I add grep into this ruby script?

I have this script that will increase my entered date, seven days. I need to add something to this script (i don't know how to do it) that will search a log file doing a word count for the words password and change and put that output to a file. then again for the next date and so on and so on. The log files being searched begin with the date (example 2010-10-31......) and have a time stamp after it.

So i need it to read the date (which I have), search that dated log file (which I don't have) increase the date and do it again, 7 times.

Please help. I am looking to use the date in a grep before it changes, then use it again, etc...

Code:
echo "Enter date[mm/dd/yyyy]: "
read date
echo $date | ruby -e 'require "date";d,m,y=gets.chomp.split("/");t=Date.new(y.to_i,d.to_i,m.to_i);1.upto(7){|x|p t.to_s;t+=1}'



---------- Post updated 09-22-10 at 08:04 AM ---------- Previous update was 09-21-10 at 12:05 PM ----------

please, need help! please!!!SmilieSmilie

Last edited by bbraml; 09-22-2010 at 11:32 AM.. Reason: code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. What is on Your Mind?

Ruby language

Hi All, Could you please suggest books for learning ruby and python language ? Thanks, Pravin (1 Reply)
Discussion started by: pravin27
1 Replies

2. Shell Programming and Scripting

Printf with backreference in ruby

Hello everybody, May you help with this, I don't know what is wrong. I want trying to print the first 4 characters as decimal and remove the "k's" from the next 7 characters. I'm trying with gsub and backrefence as shown below trying to remove the "k's" and then trying to assign to "x" the... (0 Replies)
Discussion started by: Ophiuchus
0 Replies

3. Shell Programming and Scripting

Comment/Devbug traverser ruby Script

Hello all, i need some help, having never herd of ruby before i joined my workplace im now saddled with alot of scripts written in ruby and i need to find out how to debug certain things (values of array's hashes etc). What i need is how to view each step in this command in a log file: ... (0 Replies)
Discussion started by: limamichelle
0 Replies

4. Web Development

Permission problems calling Ruby from php script

I'm just getting my feet wet with web development, so hopefully this is a simple thing I'm overlooking, but so far I'm stumped. I have a php script that calls Ruby via exec(). This works fine in my test environment, but when I moved it to my production environment I run into a permissions... (7 Replies)
Discussion started by: dantes990
7 Replies

5. Shell Programming and Scripting

script use min resource ( grep grep)

Hi i wrote script use it as watchdog ( i mean it check another program (pooya) whenever that was killed (closed or crashed) it run another script (pooya_start.sh) to start it, this script work fine and do the job for me , i need help of an expert to tell me (exact command) how to change this... (8 Replies)
Discussion started by: pooyair
8 Replies

6. Shell Programming and Scripting

What is Ruby?

Lately there have been a lot of one-liners posted in "ruby" on the apparent assumption that mainstream unix or Linux come with "ruby. They don't. What is "ruby"? What platforms and Operating System versions are supported? The syntax for "ruby" seems remarkably obscure compared with say "awk"... (13 Replies)
Discussion started by: methyl
13 Replies

7. Programming

Needed help in a ruby script with user interaction involved!

Hi all, I am struck at this point and needed some help in ruby I wanted to write a script that accepts the no of VNICs the user wants to create and then ask for the name of each Vnic he wants then use these names to create the corresponding Vnics Eg: suppose that there are 2 Vnics to be... (0 Replies)
Discussion started by: wrapster
0 Replies
Login or Register to Ask a Question