title: AWK comparing two files and printing individual columns
body: <p>I need help in comparing two files using awk script. Compare second column of file1.csv to the first column of file2.csv, if matches print the row in the following expected format.</p>
  <p>file1.csv</p>
  <pre><code>abc,id123,newyork
  bcd,id456,seattle
  </code></pre>
  <p>file2.csv</p>
  <pre><code>id678,bbb,ccc
  id123,hhh,ddd
  </code></pre>
  <p>expecte format:</p>
  <pre><code>abc,id123,hhh,newyork,{hhh,ddd},ddd
  
  </code></pre>
  <p>I am able to print up to the following so far</p>
  <pre><code>abc,id123,newyork,hhh,ddd
  </code></pre>
  <p>using the following awk,</p>
  <pre><code>$ awk -F, 'FNR==NR{f1[$2]=$0; next} $1 in f1 {print f1[$1] &quot;,&quot; $2 &quot;,&quot; $3}' file1.csv file2.csv
  </code></pre>