I have a question related to the range option in gawk BEGPAT, ENDPAT {ACTION}
, it seems unsuited to my case OR MORE LIKELY the problem is my misunderstanding of how range works.
I want to print/select the records/lines between a range of dates of the form YYYY-MM-DD. The dates are in a specific FIELD/Column, they are in ascending order, and they are not unique, ie:
2021-08-01
2021-08-02
2021-08-02
2021-08-02
2021-08-03
2021-08-04
2021-08-05
2021-08-05
2021-08-05
How can I select lets say, from 2021-08-02 to 2021-08-05, the actual data goes back two years, to get:
2021-08-02
2021-08-02
2021-08-02
2021-08-03
2021-08-04
2021-08-05
2021-08-05
2021-08-05
I tried the following:
'/2021-08-03/, /2021-08-05/{print}'
Resulting in this:
2021-08-03
2021-08-04
2021-08-05
Any help within the scope of gawk/awk is appreciated. The documentation about ranges is here, but since I'm just trying to learn to code it can difficult to understand sometimes. Perhaps there are other approaches within awk to solve this?