How to generate Calendar Mini Program in shell using AWK
This article mainly introduces "how to use AWK to generate calendar Mini Program in shell". In daily operation, I believe many people have doubts about how to use AWK to generate calendar Mini Program in shell. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "how to use AWK to generate calendar Mini Program in shell". Next, please follow the editor to study!
Code snippet:
# generate calendar in shell # usage # awk-f thisfile + 2011calendar awk-f thisfile + 2017.1calendar awk-f thisfile + 2017.10.10#function whichweek (y, m, d S) {s = 0 if (y% 4 = = 0) & & (y0! = 0)) | | (y% 400 = = 0) if (m [2] = = 28) m [2] + + if (y > 0) s + =-y + int (yUniver 4)-int (yUniver 400) + int (ycan400) while (m > 1) s + = m [- m] return (sqd)% 7} function printcalendar (y, m, d, nowweek) I) {printf ("% d% s% d% s\ n", y, "year", m, "month") print "day one, two, three, four, five, six" printf ("% s", repeat (", (nowweek+1)% 7) * 3) for (iTun1) I