Akim Demaille wrote:
I'm trying to find a means, given a week number, to find the date of
the Monday and Friday.  I was wondering if I could use GNU date to do
that straightforwardly instead of having to program this.


Akim,

%u (numerical-day-of-week) is useful here

This should work


DATE="10 august 2007"  # a random date
OFFSET=$(( $(date --date="${DATE}" +%u ) - 1))
date --date="$DATE $OFFSET days ago"

HTH,
Colin S. Miller



BTW,
The first week (before the week's start day),
can be week 0 in some systems.

_______________________________________________
help-gnu-utils mailing list
help-gnu-utils@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-utils

Reply via email to