-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathalphabetical-ordering.sh
More file actions
executable file
·35 lines (27 loc) · 1.01 KB
/
alphabetical-ordering.sh
File metadata and controls
executable file
·35 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Reorder glossary and store just the reordered content in a temp file
perl -0777 -ne '
(undef,@paragraphs) = split /^##(?=[^##])/m;
print map {"##$_"} sort @paragraphs;
' staking-glossary.md > staking-glossary-temp-1.md
# Delete everything after the first --- in and store in a temp file
sed '/---/q' staking-glossary.md > staking-glossary-temp-2.md
# Combine the two files
cat staking-glossary-temp-2.md > staking-glossary.md
cat staking-glossary-temp-1.md >> staking-glossary.md
# Delete the temp files
rm staking-glossary-temp-1.md
rm staking-glossary-temp-2.md
# Reorder FAQ and store just the reordered content in a temp file
perl -0777 -ne '
(undef,@paragraphs) = split /^##(?=[^##])/m;
print map {"##$_"} sort @paragraphs;
' faq.md > faq-temp-1.md
# Delete everything after the first --- and store in a temp file
sed '/---/q' faq.md > faq-temp-2.md
# Combine the two files
cat faq-temp-2.md > faq.md
cat faq-temp-1.md >> faq.md
# Delete the temp files
rm faq-temp-1.md
rm faq-temp-2.md