Here is a simple one liner to get the week of month via awk from a `cal` output:
$ cal | awk -v date="`date +%d`" '{ for( i=1; i <= NF ; i++ ) if ($i==date) { print FNR-2} }'
Week of Month
Submitted by sandip on Thu, 01/08/2009 - 10:24
Here is a simple one liner to get the week of month via awk from a `cal` output: $ cal | awk -v date="`date +%d`" '{ for( i=1; i <= NF ; i++ ) if ($i==date) { print FNR-2} }' »
|
See AlsoUser loginRecent blog posts
Who's onlineThere are currently 0 users and 5 guests online.
|
Hallo
Thank you for the one liner. But the script did't get a return with wheezy (7). With Squeeze i have no problems.