learingperl01
MIS
Hello,
wondering how I would go about doing this. I have a script that searches logs based on a date range of sdate and edate. The script work for the most part, except when the date has a 0 (zero) in the date field. For example when running the script if a sdate of 20080501 and edate of 20080515 is passed with the script, when the script counts up from the day 01 to 15 it removes the 0 in 01-09 printing it as 1,2,3,4,5,6,7,8,9 instead of 01,02,03,04,05,06. I was wondering what the best way would be to fix that.
Is there anyway to force the count or add the zero to only the 01-09 entries?
thanks for help
wondering how I would go about doing this. I have a script that searches logs based on a date range of sdate and edate. The script work for the most part, except when the date has a 0 (zero) in the date field. For example when running the script if a sdate of 20080501 and edate of 20080515 is passed with the script, when the script counts up from the day 01 to 15 it removes the 0 in 01-09 printing it as 1,2,3,4,5,6,7,8,9 instead of 01,02,03,04,05,06. I was wondering what the best way would be to fix that.
Code:
sample code
begin_date=`echo $strd |cut -c5-6` #this will output start day
end_date=`echo $etrd |cut -c5-6` #this will output end day
until [ -eq ]
do
let "begin_date=$begin_date + 1" #doing this removes the 0 from 01,02,03 etc.
Is there anyway to force the count or add the zero to only the 01-09 entries?
thanks for help