|
From: | Colin S. Miller |
Subject: | Re: generate date sequences |
Date: | Thu, 15 Sep 2005 22:19:58 +0100 |
User-agent: | Debian Thunderbird 1.0.2 (X11/20050602) |
mnikhil@gmail.com wrote:
Hi With gnu date, how can I get the list of dates continuosly between a specific period say for example apr 2,2005 to july 31,2005 in the format %Y/%m/%d command should be in the form of ./script -d1 04/02/2005 -d2 06/31/2005 2005/04/02 2005/04/03 2005/04/04 .. .. .. 2005/07/29 2005/07/30/ 2005/07/30 Help is very much appreciated. Thanks, Nikhil
for (( a=0 ; $a \< 10 ; a++ )) ;do date -d "5 april 2005 $a days";done Tue Apr 5 00:00:00 BST 2005 Wed Apr 6 00:00:00 BST 2005 Thu Apr 7 00:00:00 BST 2005 Fri Apr 8 00:00:00 BST 2005 Sat Apr 9 00:00:00 BST 2005 Sun Apr 10 00:00:00 BST 2005 Mon Apr 11 00:00:00 BST 2005 Tue Apr 12 00:00:00 BST 2005 Wed Apr 13 00:00:00 BST 2005 Thu Apr 14 00:00:00 BST 2005finding the correct +"FORMAT" string is left as an exerise for the interested reader. It will be in the man page.
Although it works, it may be use feature rather than actual design of GNU date. --Replace the obvious in my email address with the first three letters of the hostname to reply.
[Prev in Thread] | Current Thread | [Next in Thread] |