## How to find second and fourth Monday of the month?

How to find second and fourth Monday of the month?
# 15
That's because the algorithm assigns day 7 to the second week already, which is the case for the second Monday of September and December, 2015. On top, the empty lines are due to invalid dates for months that dont have a 31., or 29., 30., 31. for February. And, DATE and dayofmonth hold identical values. Try the modified script:
 RudiC View Public Profile for RudiC Find all posts by RudiC
# 16
Quote:
Originally Posted by RudiC
That's because the algorithm assigns day 7 to the second week already, which is the case for the second Monday of September and December, 2015. On top, the empty lines are due to invalid dates for months that dont have a 31., or 29., 30., 31. for February. And, DATE and dayofmonth hold identical values. Try the modified script:
Thanks RudiC.
Can you please advise how are you coming up with the value 10 in below code? Basically, I want to understand the thought process while selecting the value, so the logic will be clear and will help in long run.
 Prathmesh View Public Profile for Prathmesh Find all posts by Prathmesh
# 17
man bash:
Quote:
Constants with a leading 0 are interpreted as octal numbers. A leading 0x or 0X denotes hexadecimal. Otherwise, numbers take the form [base#]n, where the optional base is a decimal number between 2 and 64 representing the arithmetic base, and n is a number in that base.
August and September will make the calculation fail unless the base is specified. I can't tell how far this applies to other shells...
This User Gave Thanks to RudiC For This Post:
 RudiC View Public Profile for RudiC Find all posts by RudiC
# 18
Ah, yes. I hadn't thought of Monday 7th being the first week.

Robin
This User Gave Thanks to rbatte1 For This Post:
 rbatte1 View Public Profile for rbatte1 Visit rbatte1's homepage! Find all posts by rbatte1
# 19
Quote:
Originally Posted by RudiC
man bash: August and September will make the calculation fail unless the base is specified. I can't tell how far this applies to other shells...
Thanks. Script works well.

When searched more, I found out that instead of using %d option of date, if we use %e it works well.

Output:
---------- Post updated at 04:24 PM ---------- Previous update was at 04:21 PM ----------

Quote:
Originally Posted by rbatte1
Ah, yes. I hadn't thought of Monday 7th being the first week.

Robin
Thanks Robin/RudiC and others for all your help.

Last edited by Prathmesh; 07-01-2015 at 07:52 AM.. Reason: editing content
 Prathmesh View Public Profile for Prathmesh Find all posts by Prathmesh

Test Your Knowledge in Computers #301
Difficulty: Easy
Slackware was originally derived from the Software Linux System (SLS).
True or False?

## Find one month before date

Hi, I want two dates one will be the current date and the other one will be just one month before. Say if current month is 11/4/2014 then the other date should be 11/3/2014. #!/bin/ksh currentDtae=`date` oneMonthBefore= ? I dont know how to do it. Went through some of the related threads...

## How to find last two files for a month?

Hi All, I need to find last two files for the month. lets say there are following files in directory -rwxr-xr-x 1 user userg 1596 Mar 19 15:43 c.txt -rwxr-xr-x 1 user userg 1596 Mar 21 15:43 d.txt -rwxr-xr-x 1 user userg 1596 Mar 22 15:43 f.txt -rwxr-xr-x 1...

## How to find a file created in UNIX every monday.???

Hi All Any one please suggest me... I have one directory every monday one file will be created in that directory. so if the file is created on monday or not i need check first. How can write a script??? if the file is not created i want to quit from script. Thanks K.Srinivas

## Crontab For First Monday Of Every Month!!

Hi, Could any one please let me know the crontab entry for scheduling a job for every first monday of the month? Thank You in advance, Sue

## cron script -run every 2nd day of month except Monday

I know I can't schedule this in cron and would have to write a wrapper around my script and schedule it in cron ....but not sure how do to this? How do I exclude Monday if the 2nd day of the month falls on a Monday? Thanks. I tried this: 0 0 2 * 0,2-6 command And I know this doesnt...

## I wanted to get the date of the first monday of a month.

Hi, I need to display the date of the first monday of a month. Can any one please help me on this. Thanks in advance.

## find out month from a date

I would like to find out the month from a given date, how is it possible.

## how can i find the third friday of each month?

Help please! I need to read the calendar and put the date of the third Friday of each month into a variable for comparison in an "if" statement. How would I do this? Thnx, leslie02

## Find all files by month

Hi, I am trying to do achieving of files by months. find /test -name \*.* -mtime +30 will give me the result of all modified files after 30 days. But lets say i want to list all files that is modified in last months... what is the command to do it? Thanks!

## Crontab First Monday of Month only

Is there a way to setup a cronjob that will only run on the first monday of the month?