Brain Phrye

code cooking diy fiction personal photos politics reviews tools 


Bash Letter Fun

For some reason I thought sorting the letters of the alphabet by the words we use to pronounce them would be amusing. So i wrote this.

Column 2 is American-English, column 3 is Hiberno-English. Since it might be interesting to do other languages - at least ones that use these 26 letters - I wrote the script so it can handle more columns.

The current results are:

1
2
3
A H R B D W E F L M N S X G I J K O P Q C T V Y U Z

A B D W E F L M N S X H I J G K O R P Q C T V Y U Z

The script is here:

 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
36
37
38
#!/bin/bash

# shellcheck disable=SC2046
for i in $(seq $(grep '^A:' "$0" | tr -dc : | wc -c) ); do
  sed -n '/^A:/,$p' "$0" \
    | sort -t: -k$((i + 1)) \
    | cut -d: -f1 \
    | tr '\n' ' ' \
    | sed 's/ $/\n\n/'
done
exit 0

A:a:a
B:be:be
C:see:see
D:dee:dee
E:ee:ee
F:eff:eff
G:gee:jee
H:aitch:haitch
I:i:i
J:jay:jay
K:kay:kay
L:el:el
M:em:em
N:en:en
O:oh:oh
P:pee:pee
Q:queue:queue
R:are:or
S:ess:ess
T:tee:tee
U:you:you
V:vee:vee
W:double-you:double-you
X:ex:ex
Y:why:why
Z:zee:zed