I know the command to get the week number of a date is date +%WOutput: 03Now, is there a way of giving a week number it will display all the dates in that week? Or should I write a script?Eg:Input: 03Output:Jan 20Jan 21Jan 22Jan 23Jan 24Jan 25Jan 26First week (Jan 1, 2, 3,4 and 5) are considered as week no '0'. So the first week starts from 6th jan(First Monday in Jan 2014), 2nd week starts from 13th and third week starts from 20th
Display all the dates in week numbers in UNIX
date
I decided to rip this stackoverflow question and further adapt it to your question:#!/bin/bashweek=$1 year=$2date_fmt=+%b %dweek_num_of_Mon_1=$(date -d $year-01-01 +%W)week_day_of_Mon_1=$(date -d $year-01-01 +%u)if ((week_num_of_Mon_1)); then   first_Mon=$year-01-01else   first_Mon=$year-01-$((01 + (7 - week_day_of_Mon_1 + 1) ))fifor nr_of_day_of_week in 0 1 2 3 4 5 6do    day_of_week=$(date -d $first_Mon +$((week - 1)) week + $nr_of_day_of_week day $date_fmt)    echo $day_of_weekdoneExample: weekof 17 2014Result:Apr 28Apr 29Apr 30May 01May 02May 03May 04I hope it helps!