can any one help me fix the error in this - i am still a novice in shell programming. I got this code after some googling now the code works with all the dates( as much as i know) except for 08 th and 09th of every month. can any one of you please help me fix this issue?
Posix, in their wisdom, decided that a leading zero indicates an octal constant so 08 and 09 are illegal octal constants. This change broke a lot of code. Did you test for month=8 or 9? Also week number = 8 or 9?
Define precisely what you mean by week number. Are the first 7 days of the year always week 1?
Perderabo - I have checked for the month 08 and 09 it is working perfectly fo r other dates. it also works for the week 09 and 08 but the issue is only with the day being 09 or 08 any suggestions would be of great help. I have seen your code of sword fish(Gosh) thats a wonderful peice of work. I hope you have a solution for this as well. it is calculated with the ISO way like the first week could start as soon as 28th of dec or as late as 3rd of jan.
Thanks for posting your final solution. I don't recall ever hearing of ISO week numbers before. So I will add this thread to our date arithmetic FAQ article. I found this page which has an on-line calculator for ISO week numbers.
For the record, here is a datecalc based solution. It emulates the behavior of the on-line calculator in that it outputs a year, a week number, and a day of week number...
Perderabo - this code give's error. and thanks for letting me know that the leading zero was causing the trouble. Now everything is fine - Cheero!!!!!!
./test.sh[22]: datecalc: not found
./test.sh[23]: !dow: bad number
calcisoweek[6]: datecalc: not found
calcisoweek[8]: datecalc: not found
calcisoweek[9]: datecalc: not found
calcisoweek[6]: datecalc: not found
calcisoweek[8]: datecalc: not found
calcisoweek[9]: datecalc: not found
2004-W00-
A quick question for you - in one of my shell scripts i am trying to replace some characters using a variable value(keeps changing) using sed. Now when there is an "&" sign in the variable value then at the place of "&" instead of placing the "&" it places the value that is being replaced with. I am not sure if gsub of awk works with this - but can you plz explain me how to avoid this scenario as i cannot place the "\" because its a variable and the place or "&" changes as well. is there a way to avoid this?????