The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
DSA is unwilling to perform melanie_pfefer SUN Solaris 0 04-24-2008 09:57 AM
performing a task at regular intervals mridula High Level Programming 2 11-14-2005 05:26 AM
mailing myself at regular intervals... timepassman Shell Programming and Scripting 4 08-21-2005 08:11 PM
Date Intervals yongho Shell Programming and Scripting 7 07-29-2005 04:19 PM
Schedule a Batch file to delete files at particular intervals Indom Windows & DOS: Issues & Discussions 6 02-04-2004 12:57 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 06-21-2005
yongho yongho is offline
Registered User
  
 

Join Date: Jun 2005
Location: New York City
Posts: 95
How to perform Date Intervals?

I have a 300 line script which generates key performance indicators for one of our systems. Since I just started learning sh/ksh half a month ago there's still a lot I haven't had experience with yet.

Currently, the script generates the report for a specific day. (It takes the date specified by the user such as 20050621 (yyyymmdd) and then does something like "ls -al | grep <date format>" to retrieve csv files for that particular day.

I need some guidance/advice on how I could take this script and loop it for date intervals: The user can input two dates, such as "I want to generate reports for everyday in between 20040415 to 20050620 and I don't wish to include weekends".

I was thinking maybe something like.. create a bunch of start and end variables before the loop and then running a bunch of nested while loops or some other kind of loop that goes through first the year, then the month, then the days. Does this sound okay or does anyone suggest an easier approach?

Is there another command that is similar to what the date/time format for the crontab command does? Because in crontab you can choose everything down to the second, with exceptions.

I just don't want to reinvent the wheel if I don't need to because I'd have to code how to calculate the leap year, and then the days of each month, etc
 

Bookmarks

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

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




All times are GMT -4. The time now is 01:32 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0