title: using awk to extract and split
body: <p>i am trying to extract a substring with awk from a command answer in bash</p>
  
  <p>example output line:  <strong>abc_def_ghi jkl_lmn_opq</strong></p>
  
  <p>getting the second part is easy by </p>
  
  <pre><code>echo abc_def_ghi jkl_lmn_opq | awk '{print $2}'
  </code></pre>
  
  <p>but i only need the last part substring "opq" and didn't find a way to let awk run twice over the string, when i pass the result from above to a var and use this var for second awk i get an error because the string is a path and therefore a Directory. too i didn't get sed to work with the same error when used on a stored var with the string and i did not manage to pass first substring to second awk or sed. weird? </p>
  
  <p>this would do the Job if not first awk would print out instead of passing to second awk</p>
  
  <pre><code>echo abc_def_ghi jkl_lmn_opq | awk '{print $2}' | awk -F"_" '{print $3}'
  </code></pre>
  
  <p>works neither</p>
  
  <pre><code>echo abc_def_ghi jkl_lmn_opq | awk '{$2}' | awk -F"_" '{print $3}'
  </code></pre>
  
  <p>how can i pass it right to secondly strip?</p>