title: Unix command to print the 2nd part of the data after matched pattern
body: <p>I have a specified set of string with some keywords to match.</p>
  
  <p>Key words are : string will contain "CREATESETTABLE" and dot(.) and TABLENAME
  In below sample string, DATABASE1 and DATABASE2 are dynamic but after that a dot(.) will come then followed by TABLENAME; but dot(.) and TABLENAME may repeat n times.</p>
  
  <blockquote>
    <p>string="CREATESETTABLEDATABASE1.TABLE1(uid)CREATESETTABLEDATABASE1.TABLENAMEuid,cid,mid)DATABASE2.TABLENAME(hi,hello)"</p>
  </blockquote>
  
  <p>What i used is : </p>
  
  <pre><code>echo "$string" | awk -F'CREATESETTABLE+[^ ]+.TABLENAME' '{print $2}'
  </code></pre>
  
  <p>Actual out put is : <code>(hi,hello)</code></p>
  
  <p>Expected out put is: <code>uid,cid,mid)DATABASE.TABLENAME(hi,hello)</code></p>
  
  <p><strong>Note:</strong> Use the keywords which i specified in this example. Dont use other keywords such as "(" ; other data are dynamic only what i said is static</p>