September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
11
Task/Morse-code/Sed/morse-code-1.sed
Normal file
11
Task/Morse-code/Sed/morse-code-1.sed
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sed -rf
|
||||
# Convert to uppercase
|
||||
s/.*/\U&/
|
||||
# Add lookup table
|
||||
s/$/\nA.-B-...C-.-.D-..E.F..-.G--.H....I..J.---K-.-L.-..M--N-.O---P.--.Q--.-R.-.S...T-U..-V...-W.--X-..-Y-.--Z--../
|
||||
# Main loop
|
||||
:a
|
||||
s/([A-Z])([^\n]*\n.*\1([-.]+))/\3 \2/
|
||||
ta
|
||||
# Remove lookup table
|
||||
s/\n.*//
|
||||
Loading…
Add table
Add a link
Reference in a new issue