loading...

re: Daily Challenge #291 - Extended Weekend VIEW POST

FULL DISCUSSION
 

Solution in Bash and some general commands.

#!/bin/bash
solve () {
  seq $1 $2 |
    sed -n -e'h;s/$/'{01,03,05,07,08,10,12}'01/;p;x' |
    LANG=C date -f- +'%b %a' |
    grep Fri |
    awk 'NR==1{printf $1}END{print " "$1" "NR}'
}

solve 2016 2020   # => Jan May 5
solve 1900 1950   # => Mar Dec 51
solve 1800 2500   # => Aug Oct 702
solve 1000 275760 # => Aug Aug 274761
solve 1973 1973 #=> [empty] [empty] 0
Code of Conduct Report abuse