how to generate a text file in Linux as below.
Workweek, with 7 dates on each line.
2016WW22=20160521:20160522:20160523:20160524:20160525:20160526:20160527:
2016WW23=20160528:20160529:20160530:20160531:20160601:20160602:20160603:
how to generate a text file in Linux as below.
Workweek, with 7 dates on each line.
2016WW22=20160521:20160522:20160523:20160524:20160525:20160526:20160527:
2016WW23=20160528:20160529:20160530:20160531:20160601:20160602:20160603:
Something like this, perhaps:
for i in {0..202} ; do date --date "$i days 2016-05-21" +%Y%m%d ; done |\
awk 'NR%7==1 {print ""} {printf $1 ":"}' | \
awk 'BEGIN { n=22 } $1!="" { printf "2016WW%02d=%s\n",n++,$1}'
Adjust numbers to your likings.
cal -w -y
be enough? From that you can grep and awk what you need. – grochmal Jun 16 '16 at 02:29