title: awk to print the fields based on condition:
body: <p>I would like to compare <code>first field and third filed</code> of Input.csv file with <code>Second and third fields</code> of Master.csv.
  And if the <code>fruits name matches</code> and the Amount of Master.csv <code>is less than</code> Amount of Input.csv then print all the lines from both the files.</p>
  
  <p>For example, 
  <code>Fruits==Apple,Amount &lt;20</code> from Master.csv need to be checked with Input.csv, so the output would be </p>
  
  <pre><code>Fruits,Region,Amount,Details
  Apple,North,10,Abc
  Apple,south,9,Abc
  </code></pre>
  
  <p>Input.csv</p>
  
  <p>Fruits,Region,Amount,Details</p>
  
  <pre><code>Apple,North,10,Abc
  Orange,East,115,Def
  Apple,south,9,Abc
  Apple,West,25,Abc
  Orange,West,150,Def
  Orange,North,200,Def
  Mango,North,50,Ghi
  Mango,East,75,Ghi
  </code></pre>
  
  <p>Master.csv</p>
  
  <pre><code>Details,Fruits,Amount
  xxx,Apple,20
  yyy,Mango,60
  zzz,Cherry,80
  </code></pre>
  
  <p>Desired Output.csv</p>
  
  <pre><code>Fruits,Region,Amount,Details,Details,Fruits,Amount
  Apple,North,10,Abc,xxx,Apple,20
  Apple,south,9,Abc,xxx,Apple,20
  Mango,North,50,Ghi,yyy,Mango,60
  </code></pre>
  
  <p>I have tried like below command </p>
  
  <pre><code>awk -F "," 'FNR==NR {a[$1]; b[$3]; next} $2 in a &amp;&amp; $3 &lt; b' Input.csv Master.csv &gt; Output.csv
  </code></pre>