Using Sed bash Script On Linux To Generate Morse Code Without Sound

Go down

Using Sed bash Script On Linux To Generate Morse Code Without Sound Empty Using Sed bash Script On Linux To Generate Morse Code Without Sound

Post by jamied_uk on 15th July 2016, 01:03

Code:
#!/bin/sed -rf
# https://www.rosettacode.org/wiki/Morse_code#Python
# usage ./morse.sh
# 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.*//
# echo hello world! | ./morse.sh

jamied_uk
jamied_uk
Admin

Posts : 2472
Join date : 2010-05-09
Age : 36
Location : UK

http://address-shortner.co.uk

Back to top Go down

Using Sed bash Script On Linux To Generate Morse Code Without Sound Empty Re: Using Sed bash Script On Linux To Generate Morse Code Without Sound

Post by jamied_uk on 15th July 2016, 02:27

jamied_uk
jamied_uk
Admin

Posts : 2472
Join date : 2010-05-09
Age : 36
Location : UK

http://address-shortner.co.uk

Back to top Go down

Using Sed bash Script On Linux To Generate Morse Code Without Sound Empty Re: Using Sed bash Script On Linux To Generate Morse Code Without Sound

Post by jamied_uk on 15th July 2016, 02:29

More


Code:
For every character in string:
   If character is '.':
     play "shortBeep"
   else if character is '-'
     play "shortBeep"
     play "shortBeep" # or play "longBeep"
   else
     play "noBeep" # or wait


https://unix.stackexchange.com/questions/273318/how-can-convert-characters-into-characters-thatll-produce-beep-noises/273325
jamied_uk
jamied_uk
Admin

Posts : 2472
Join date : 2010-05-09
Age : 36
Location : UK

http://address-shortner.co.uk

Back to top Go down

Using Sed bash Script On Linux To Generate Morse Code Without Sound Empty Re: Using Sed bash Script On Linux To Generate Morse Code Without Sound

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum