title: Awk using index with Substring
body: <p>I have one command to cut string.</p>
  
  <p>I wonder detail of control index of command in Linux "awk"</p>
  
  <p>I have two different case.</p>
  
  <p>I want to get word "Test" in below example string.</p>
  
  <pre><code>1. "Test-01-02-03"    
  2. "01-02-03-Test-Ref1-Ref2
  </code></pre>
  
  <p>First one I can get like </p>
  
  <pre><code>substr('Test-01-02-03',0,index('Test-01-02-03',"-"))
  -&gt; Then it will bring result only "test"
  </code></pre>
  
  <p>How about Second case I am not sure how can I get Test in that case using index function.</p>
  
  <p>Do you have any idea about this using awk?</p>
  
  <p>Thanks!</p>