Using sed or tr to capitalize the last letter of words that begin with a specified character/expression
<p>I want to capitalize the last letter of words that begin with certain letters.</p>

<p>Example: <code>At The Movies</code> to <code>AT ThE Movies</code></p>

<p>I tried...</p>

<pre><code>$ sed 's/\&lt;[ABEXY][[:alpha:]]*\([[:alpha:]]\&gt;\)/\U\1/g' file1
</code></pre>

<p>But this replaces all the words I am trying to change with an upper case of their last letter</p>

<p>Also tried:</p>

<pre><code>$ sed '/\&lt;[ABEXY][[:alpha:]]*\([[:alpha:]]\&gt;\)/ y/\1abcdefghijklmnopqrstuvwxyz/\1ABCDEFGHIJKLMNOPQRSTUVWXYZ/' file1
</code></pre>

<p>But backcalling doesn't work with <code>sed y</code> So I just got all caps.</p>