title: Replacing part of a string in bash using sed
body: <p>In bash, suppose I have the input:</p>
  
  <pre><code>ATGTGSDTST
  </code></pre>
  
  <p>and I want to print:</p>
  
  <pre><code>AT
  ATGT
  ATGTGSDT
  ATGTGSDTST
  </code></pre>
  
  <p>which means that I need to look for all the substrings that end with 'T' and print them.
  I thought I should use sed inside a for loop, but I don't understand how to use sed correctly in this case.
  Any help?
  Thanks</p>