3 ms·
This uses the GNU version of sed and the BSD versions of everything else. Roughly: print the calendar, transpose the data, get the line with only Thursdays, cou
by 1-more 5y ago
This uses the GNU version of sed and the BSD versions of everything else. Roughly: print the calendar, transpose the data, get the line with only Thursdays, count the spaces between the dates fo the Thursdays. Just realized I have a picket fence error. You can fix that. Also it's the wrong month. Also it's horribly unportable. Also it rocks.
cal | sed 1d | rs -T | grep Th | sed -e 's/\( \+$\|^Th \+\)//g' -e 's/ \+/_/g' -e 's/[^_]//g' | wc -c