title: How to use sed or awk to extract substring
body: <p>I have a file that contains the following:</p>
  
  <pre><code>[class:ABC_DEF_GHI]
  [class:ABC_DEF_GHI:app:ABC_DEF_GHI]
  </code></pre>
  
  <p>My goal is to extract ABC_DEF_GHI</p>
  
  <p>Here is the script I'm trying to write so far. </p>
  
  <pre><code>eval sed -n 's/.*app://p' file.txt &gt;&gt; $file
  </code></pre>