UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 26th, 2003, 01:42 AM
eMBee eMBee is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 1 eMBee User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy C Shell gurus, please help!!!

I want to create an automated script that runs each day. What I want the script to do is to grep on the previous day's date (yesterday) from a text file and output the results to a file. Date is in the format as shown below:

egrep "\[01\/Nov\/2003" /mydir/myfiles/ > /home/tmp/mytestfile

How can I achieve this result?

Thanks in advance

Reply With Quote
  #2  
Old February 4th, 2004, 11:11 AM
gruntz gruntz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 53 gruntz User rank is Private First Class (20 - 50 Reputation Level)gruntz User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 22 h 39 m 25 sec
Reputation Power: 5
perl?

I know using yesterday can turn into a total mess. One idea comes to mind , write your script in perl, invoke date(use Date::Calc qw(:all)) and use add_Delta_days.

You can find Date::Calc using google - search for "perl Date::Calc"

The syntax: Add_Delta_Days($year,$month,$day,"#DaysToAdd") in your case #DaysToAdd would by -1. This will return the day before the $year,$month,$day from above in the format year,month,day.

You can then use that to grep your directories/files in perl using either the system("command") or back ticks `command`.

Good luck.................

Last edited by gruntz : February 4th, 2004 at 11:15 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > C Shell gurus, please help!!!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway