![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| date format | ali560045 | Shell Programming and Scripting | 4 | 01-25-2008 07:11 AM |
| date issue-find prevoius date in a patricular format | bsandeep_80 | UNIX for Advanced & Expert Users | 3 | 11-15-2007 08:42 PM |
| Date format | Knotty | UNIX for Dummies Questions & Answers | 2 | 04-11-2007 01:48 PM |
| convert mmddyy date format to ccyyddd format?? | Bhups | Shell Programming and Scripting | 2 | 09-27-2006 11:30 PM |
| date format | big123456 | Shell Programming and Scripting | 2 | 07-22-2005 04:57 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Code:
#!/bin/sh
s="2007 12 31"
year=`echo $s | cut -d" " -f1`
mon=`echo $s | cut -d" " -f2`
day=`echo $s | cut -d" " -f3`
cal $2 $1 | awk 'BEGIN{
d["Su"]="Sun"
d["Mo"]="Mon"
d["Tu"]="Tue"
d["We"]="Wed"
d["Th"]="Thu"
d["Fr"]="Fri"
d["Sa"]="Sat"
y[1]="Su"
y[2]="Mo"
y[3]="Tu"
y[4]="We"
y[5]="Th"
y[6]="Fr"
y[7]="Sa"
month["01"]="Jan"
month["02"]="Feb"
month["03"]="Mar"
month["04"]="Apr"
month["05"]="May"
month["06"]="Jun"
month["07"]="Jul"
month["08"]="Aug"
month["09"]="Sep"
month["10"]="Oct"
month["11"]="Nov"
month["12"]="Dec"
}
NR>2{
for(i=1;i<=NF;i++){
if ( $i == '"$day"' ){
print d[y[i]],month['"$mon"'],$i
}
}
}'
Code:
# ./test.sh Mon Dec 31 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|