calcuate the week number of a given date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting calcuate the week number of a given date
# 8  
Old 09-10-2005
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!!!!!!
# 9  
Old 09-10-2005
Quote:
Originally Posted by ahmedwaseem2000
Perderabo - this code give's error.
Could I ask for a more detailed error report? I tested my script before I posted it. I just retested and I cannot get it to fail.

$ ./isoweek 9 10 2005
2005-W36-6
# 10  
Old 09-12-2005
here is the error message -

./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?????
# 11  
Old 09-12-2005
Quote:
Originally Posted by ahmedwaseem2000
here is the error message -

./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-
You need to have the datecalc to run what Perderabo has posted.

Quote:
Originally Posted by ahmedwaseem2000
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?????
If this is a problem completely different from your ISO date calculation problem, start a new thread.
# 12  
Old 09-12-2005
Well, I am a quite new to this forum so i was not aware of the datecalc. and yes you are right it is a new question.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find week of the year for given date using date command inside awk

Hi all, Need an urgent help on the below scenario. script: awk -F"," 'BEGIN { #some variable assignment} { #some calculation and put values in array} END { year=#getting it from array and assume this will be 2014 month=#getting it from array and this will be 05 date=#... (7 Replies)
Discussion started by: vijaidhas
7 Replies

2. AIX

How to calcuate total number of weeks?

Hi anyone can help? How to calculate total number of weeks from a specify date, for example, 01 Jan 2012. Thx! https://www.unix.com/images/misc/progress.gif (1 Reply)
Discussion started by: rayray2013
1 Replies

3. Shell Programming and Scripting

Week number from a date.

Hi, How can we get the week number from any paricular date. lets say date is 20120404 (YYYYMMDD) then how to get the week number? date +%W --- Thic command gives the week number for current date only. Thanks. (13 Replies)
Discussion started by: 46019
13 Replies

4. Shell Programming and Scripting

Extract week start,end date from given date in PERL

Hi All, what i want to do in perl is i should give the date at run time .Suppose date given is 23/12/2011(mm/dd/yyyy) the perl script shold find week start date, week end date, previous week start date,end date,next week start date, end date. In this case week start date will be-:12/19/2011... (2 Replies)
Discussion started by: parthmittal2007
2 Replies

5. Shell Programming and Scripting

Know the number of the week for a date

Hi, I tried to find the solution on the forum without success. datecalc from Perderabo doesn't solve my problem. I would like to know how to do the same thing that date +%U but for a specific date. For example: 2011 08 27 => 39 Thinks a lot (8 Replies)
Discussion started by: Castelior
8 Replies

6. Shell Programming and Scripting

Date One Week Ago From Given Date, Not From Current Date

Hi all, I've used various scripts in the past to work out the date last week from the current date, however I now have a need to work out the date 1 week from a given date. So for example, if I have a date of the 23rd July 2010, I would like a script that can work out that one week back was... (4 Replies)
Discussion started by: Donkey25
4 Replies

7. Shell Programming and Scripting

how to obtain date and day of the week from `date` command

Hi, does anybody know how to format `date` command correctly to return the day of the week? Thanks -A I work in ksh.... (1 Reply)
Discussion started by: aoussenko
1 Replies
Login or Register to Ask a Question