SHARE
TWEET

Untitled

a guest Aug 19th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2.  
  3. gawk '
  4. BEGIN {
  5.     ONE_DAY = 60*60*24
  6.  
  7.     start_time = mktime("2019 08 07 00 00 00")
  8.  
  9.     ct = start_time
  10.     while (1) {
  11.         ct += ONE_DAY
  12.         print strftime("%Y-%m-%d", ct)
  13.     }
  14. }' |
  15. gawk '
  16. BEGIN {
  17.     FS = "-"
  18. }
  19.  
  20. function array_length(a, e,c) {
  21.     for (e in a) { c++ }
  22.     return c
  23. }
  24.  
  25. function same_elements_q(a,  i,j,l,c) {
  26.     l = array_length(a)
  27.     for (i=1; i<=l; i++) {
  28.         c = 0
  29.         for (j=1; j<=l; j++) {
  30.             if ("" a[i] == "" a[j]) {
  31.                 c++
  32.             }
  33.         }
  34.         if (c >= 2) {
  35.             return 1
  36.         }
  37.     }
  38.  
  39.     return 0;
  40. }
  41.  
  42. {
  43.     y = $1
  44.     m = $2
  45.     d = $3
  46.     sub(/^0/, "", m)
  47.     sub(/^0/, "", d)
  48.     split(y m d, a, "")
  49.     if (!same_elements_q(a)) {
  50.         print $0
  51.     }
  52. }' |
  53. head -n 1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top