<html>
<body>
<pre>
<tt>
#!/bin/sh
# ascii to baudot
# must turn bel into ~ for awk
tr -d '~' | tr '\007[a-z]' '~[A-Z]' | awk '
BEGIN {
baudot["A"] = "| o o . |"
baudot["-"] = "| o o . |"
baudot["B"] = "| o . o o |"
baudot["?"] = "| o . o o |"
baudot["C"] = "| o . o o |"
baudot[":"] = "| o . o o |"
baudot["D"] = "| o . o |"
baudot["$"] = "| o . o |"
baudot["E"] = "| o . |"
baudot["3"] = "| o . |"
baudot["F"] = "| o . o o |"
baudot["!"] = "| o . o o |"
baudot["G"] = "| o . o o |"
baudot["&"] = "| o . o o |"
baudot["H"] = "| . o o |"
baudot["STOP"] = "| . o o |"
baudot["I"] = "| o . o |"
baudot["8"] = "| o . o |"
baudot["J"] = "| o o . o |"
baudot["'\''"] = "| o o . o |"
baudot["K"] = "| o o . o o |"
baudot["("] = "| o o . o o |"
baudot["L"] = "| o . o |"
baudot[")"] = "| o . o |"
baudot["M"] = "| . o o o |"
baudot["."] = "| . o o o |"
baudot["N"] = "| . o o |"
baudot[","] = "| . o o |"
baudot["O"] = "| . o o |"
baudot["9"] = "| . o o |"
baudot["P"] = "| o . o o |"
baudot["0"] = "| o . o o |"
baudot["Q"] = "| o o . o o |"
baudot["1"] = "| o o . o o |"
baudot["R"] = "| o . o |"
baudot["4"] = "| o . o |"
baudot["S"] = "| o . o |"
baudot["BELL"] = "| o . o |"
baudot["T"] = "| . o |"
baudot["5"] = "| . o |"
baudot["U"] = "| o o . o |"
baudot["7"] = "| o o . o |"
baudot["V"] = "| o . o o o |"
baudot[";"] = "| o . o o o |"
baudot["W"] = "| o o . o |"
baudot["2"] = "| o o . o |"
baudot["X"] = "| o . o o o |"
baudot["/"] = "| o . o o o |"
baudot["Y"] = "| o . o o |"
baudot["6"] = "| o . o o |"
baudot["Z"] = "| o . o |"
baudot["\""] = "| o . o |"
baudot[""] = "| . |"
baudot[""] = "| . |"
baudot["\r"] = "| . o |"
baudot["\n"] = "| o . |"
baudot[" "] = "| . o |"
baudot["LTRS"] = "| o o . o o o |"
baudot["FIGS"] = "| o o . o o |"
end = "|-------------|"
figchars = "-?:$3!&8'\''().,901457;2/6\"\r\n "
bell = "~"
figs = 0
print end
}
{
for (i = 1; i <= length($0); i++)
{
c = substr($0, i, 1)
if (c ~ /[A-Z]/)
{
if (figs)
{
print baudot["LTRS"]
figs = 0
}
}
else if (index(figchars, c) > 0 || c == bell)
{
if (c == bell)
c = "BELL";
if (!figs)
{
print baudot["FIGS"]
figs = 1
}
}
else if (c == "\t")
c = " "
else
continue
print baudot[c]
}
print baudot["\n"]
}
END {
print end
}
'
exit
| x x . x x x |
hole == mark == 1
!hole == space == 0
BITS LTRS FIGS HEX
----- ---- ---- ---
00011 A - 03
11001 B ? 19
01110 C : 0E
01001 D $ 09
00001 E 3 01
01101 F ! 0D
11010 G & 1A
10100 H STOP 14
00110 I 8 06
01011 J ' 0B
01111 K ( 0F
10010 L ) 12
11100 M . 1C
01100 N , 0C
11000 O 9 18
10110 P 0 16
10111 Q 1 17
01010 R 4 0A
00101 S BELL 05
10000 T 5 10
00111 U 7 07
11110 V ; 1E
10011 W 2 13
11101 X / 1D
10101 Y 6 15
10001 Z " 11
00000 n/a n/a 00
01000 CR CR 08
00010 LF LF 02
00100 SP SP 04
11111 LTRS LTRS 1F
11011 FIGS FIGS 1B
</tt>
</pre>
<HR>
© 1998,
Boyd Roberts:
<A HREF="mailto:boyd@fr.inter.net">boyd@fr.inter.net</A>
</body>
</html>
|