title: Extract unique code and uid from log file using bash script
body: <p>I'm new to bash scripting and want to extract code and uid (unique) from log file into new csv file for further processing.</p>
  <p>The file contains:</p>
  <pre><code>2021-02-16T10:13:54.629Z,app,&quot;Code: 01-87-04 &amp; Diff [{:uid=&gt;&quot;&quot;asdf1234&quot;&quot;, :sid=&gt;636614}] / [{:uid=&gt;&quot;&quot;asdf1234&quot;&quot;, :sid=&gt;0}]&quot;
  2021-02-16T10:11:22.914Z,app,&quot;Code: 01-33-05 &amp; Diff: [{:uid=&gt;&quot;&quot;kx4oa3hv&quot;&quot;, :sid=&gt;644448}, {:uid=&gt;&quot;&quot;v7jfxsum&quot;&quot;, :sid=&gt;643063}] / [{:uid=&gt;&quot;&quot;kx4oa3hv&quot;&quot;, :sid=&gt;0}, {:uid=&gt;&quot;&quot;v7jfxsum&quot;&quot;, :sid=&gt;0}]&quot;
  </code></pre>
  <p>The desired output:</p>
  <pre><code>01-87-04, asdf1234
  01-33-05, kx4oa3hv
  01-33-05, v7jfxsum
  </code></pre>
  <p>I started with this script and blocked on extracting the multiple uids. Any help is appreciated.</p>
  <pre><code>#!/bin/bash
  
  echo &quot;-----&gt;Loading file&quot;
  filename=&quot;some.csv&quot;
  while read -r line; do
    scene_id=`echo &quot;$line&quot; | awk '{print $2}'`
  
    echo $scene_id
  done &lt; &quot;$filename&quot;
  </code></pre>