annotate paste/paste.6763 @ 11293:a7899ef2d7b6

<wob_jonas> learn Aristotle said that every illness can be cured by balancing the four vitreous humors, and everyone believed him for two thousand years, even though people still died of illnesses. It wasn\'t until the 20th century that Szent-Gy\xc3\xb6rgyi Albert realized that Aristotle didn\'t find fifth kind of vitreous humor, vitamin C, because the Greek alphabet
author HackBot
date Mon, 01 Jan 2018 17:57:43 +0000
parents 84da026b16a5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1381
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
1 #!/bin/sh
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
2 cd /var/irclogs/_esoteric
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
3
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
4 pasterandom() {
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
5 if [ "$1" -gt 150 ]; then
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
6 echo "No."
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
7 exit
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
8 fi
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
9 for i in $(seq "$1"); do
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
10 file=$(shuf -en 1 ????-??-??.txt)
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
11 echo "$file:$(shuf -n 1 $file)"
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
12 done | paste
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
13 }
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
14
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
15 if [ "$1" ]; then
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
16 if expr "$1" + 0 >/dev/null 2>&1; then
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
17 pasterandom "$1"
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
18 else
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
19 lines=$(grep -P -i -- "$1" ????-??-??.txt | head -n 301)
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
20 {
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
21 echo "$lines" | head -n 300
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
22 [ $(echo "$lines" | wc -l) -eq 301 ] && echo "[too many lines; stopping]"
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
23 } | paste
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
24 fi
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
25 else
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
26 pasterandom 40
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
27 fi
84da026b16a5 <GreyKnight> cat bin/pastelog | paste
HackBot
parents:
diff changeset
28