Stripping vowels from word + convert all letters to capitals + no double letters

I need a macro that will strip a word of its vowels, capitalise the remaining letters and reduce double / treble etc letters (= same letter appearing consecutively) to a single letter.
Highlight the word 'yellow'; run macro and get YLW
Highlight the word 'puppy'; run macro and get PY

Many thanks.

	# delete `-d` all vowels, upper or lowercase 
tr -d '[AaEeIiOoUu]' 

	# squeeze (-s) all remaining letters down to one instance per letter 
	# so `aaaabbbbaaa` would end up as `aba`
tr -s '[A-Za-z]' 

	# change all lowercase to UPPERCASE 
tr '[a-z]' '[A-Z]'

put all of those together and you get this:

tr -d '[AaEeIiOoUu]' | tr -s '[A-Za-z]' | tr '[a-z]' '[A-Z]'

Have a shell script that takes clipboard as input and outputs back to the clipboard.


Hi tjluoma
Thanks for getting back.
I'm afraid I'm going to need some more guidance on how to apply the above.
Consider me a beginner.
Could you direct me to a tutorial perhaps?
Many thanks.

Sure thing, sorry I was in a bit of a rush before. Here's an example macro:

Forum Post 17188 - Change Case.kmmacros (2.1 KB)

The macro assumes that you have already selected the text that you want to transform. The macro will 'cut' that text, transform it, and then paste it back in where it originally came from.

The macro has a keyboard shortcut assigned, make sure to set it to whatever you want it to be, or set it to something else.

PRFCT !!!!!
Much obliged.