![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help, I need to get the last date of previous month | sirrtuan | Shell Programming and Scripting | 11 | 10-14-2008 02:59 AM |
| last month end date | vanathi | UNIX for Advanced & Expert Users | 7 | 03-21-2008 01:17 PM |
| How do I set my date in a unix script to 'new month | Agent704 | UNIX for Dummies Questions & Answers | 1 | 01-27-2008 10:58 AM |
| Use date command to find last month | Cbish68 | Shell Programming and Scripting | 5 | 08-10-2007 07:32 AM |
| find out month from a date | rudoraj | UNIX for Dummies Questions & Answers | 5 | 07-03-2007 05:21 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
how to get month last date in unix
Hello
I want to get end date of the any month in unix . is there any function to do this. we can get month from date command 'date +%b' example: If Feb month then last date is 28 if sep then last date 30. like this thanks please help |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Try this command
You can include this in a shell script to get the month and year to pass to the below command. cal 10 05 | grep -v ^$ | tail -1 | sed 's/^.* \([0-9]*\)$/\1/' Last edited by monsanbu; 09-29-2005 at 02:39 AM. |
|
#3
|
|||
|
|||
|
try this,
cal <month> <year> | sed '/^$/d' | tail -1 | awk '{printf $NF}' |
|
#4
|
|||
|
|||
|
no use
not working
please check once again. thanks |
|
#6
|
|||
|
|||
|
Which solution is not working? Give the last two digits for year
|
|
#7
|
||||
|
||||
|
Code:
echo $(cal 10 2005) | awk '{print $NF}'
|
||||
| Google The UNIX and Linux Forums |