random-ics.awk - ics2txt - convert icalendar .ics file to plain text
(HTM) git clone git://bitreich.org/ics2txt git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ics2txt
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
random-ics.awk (661B)
---
1 #!/usr/bin/awk -f
2
3 function random(n) {
4 "exec od -An </dev/urandom" | getline num
5 return num % n
6 }
7
8 BEGIN {
9 data = "exec tr -cd -- '-a-zA-Z0-9\n' </dev/urandom"
10
11 first = 1
12 while (data | getline) {
13 if (random(2) && !first) {
14 print(" " $0)
15 continue
16 }
17 first = 0
18
19 data | getline
20 col = random(26) + 1
21 out = "X-"substr($0, 1, col)
22 $0 = substr($0, col + 1)
23 n = random(30)
24 for (i = 0; i <= n; i++) {
25 col = random(30) + 5
26 if (length($0) < col)
27 continue
28 eq = random(int(col / 2)) + 1
29 out = out ";" substr($0, 1, eq) "=" substr($1, eq + 1, col)
30 $0 = substr($0, col + 1)
31 }
32 out = out $0 ":"
33 print(out)
34 }
35
36 close(cmd)
37 }