Week of Month

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} }'

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hallo

Thank you for the one liner. But the script did't get a return with wheezy (7). With Squeeze i have no problems.

Comment