Below are my custom period start and end dates based on a calender, these dates are placed in a file, for each period i need to split into three weeks for each period row, example is given below.
Could you please help out to achieve solution through shell script..
File content:
period_start_date period_end_date period_code
2020-01-01 2020-01-15 P1
2020-01-05 2020-01-19 P2
2020-01-16 2020-01-31 P1
2020-01-20 2020-02-04 P2
2020-02-01 2020-02-15 P1
2020-02-05 2020-02-19 P2
2020-02-16 2020-02-29 P1
2020-02-20 2020-03-04 P2
2020-03-01 2020-03-15 P1
2020-03-05 2020-03-19 P2
2020-03-16 2020-03-31 P1
2020-03-20 2020-04-04 P2
2020-04-01 2020-04-15 P1
2020-04-05 2020-04-19 P2
2020-04-16 2020-04-30 P1
2020-04-20 2020-05-04 P2
2020-05-01 2020-05-15 P1
2020-05-05 2020-05-19 P2
2020-05-16 2020-05-31 P1
2020-05-20 2020-06-04 P2
Expected Result for
1) period start date 2020-01-01 Period End date 2020-01-15 Period code P1
2) period start date 2020-01-05 Period End date 2020-01-19 Period code P2
3) period start date 2020-01-16 Period End date 2020-01-31 Period code P1
4) period start date 2020-01-20 Period End date 2020-02-04 Period code P2
week Start Date Week End Date Period strat Date Period end Date Period code
2020-01-01 2020-01-05 2020-01-01 2020-01-15 P1
2020-01-06 2020-01-12 2020-01-01 2020-01-15 P1
2020-01-13 2020-01-15 2020-01-01 2020-01-15 P1
2020-01-05 2020-01-05 2020-01-05 2020-01-19 P2
2020-01-06 2020-01-12 2020-01-05 2020-01-19 P2
2020-01-13 2020-01-19 2020-01-05 2020-01-19 P2
2020-01-16 2020-01-19 2020-01-16 2020-01-31 P1
2020-01-20 2020-01-26 2020-01-16 2020-01-31 P1
2020-01-27 2020-01-31 2020-01-16 2020-01-31 P1
2020-01-20 2020-01-26 2020-01-20 2020-02-04 P2
2020-01-27 2020-02-02 2020-01-20 2020-02-04 P2
2020-02-03 2020-02-04 2020-01-20 2020-02-04 P2