I need to sort data on a weekly base and all i have are dates in a logfile. Therefore to sort out data per week i would like to create a list with the dates of all mondays for a given year. I have tried to work something out and the only idea i currently have is to use ncal with year and month as argument looping over all months and extracting all mondays. Isn't there a more efficient way?
To get all mondays, by getting all dates and filtering by Mondays:
for i in `seq 0 365` do date -d "+$i day" done | grep Mon
Of course, you could also take a monday and keep incrementing by 7 days.
1.4m articles
1.4m replys
5 comments
57.0k users