title: How to use awk script to run through a textfile
body: <p>I need to run through a textfile, <code>doctors.txt</code>, which is written in the format:</p>
  
  <pre><code>Sarah,Jenny,Charles;Dr. Hampton
  Jenny,Lucy,Harry;Dr. Fritz
  Ben,Kaitlyn,Connor,Charles;Dr. Hampton
  </code></pre>
  
  <p>and have it output:</p>
  
  <pre><code>Dr. Hampton: Sarah Jenny Charles Ben Kaitlyn Connor
  Dr. Fritz: Jenny Lucy Harry
  </code></pre>
  
  <p>(if someone is mentioned more than once I can't have them repeat)</p>
  
  <p>I need to do this using awk, I currently am having issues even trying to make it print anything:</p>
  
  <p>My code is:</p>
  
  <pre><code> #!/user/bin/awk -f
  awk 'BEGIN {for i in $(doctors.txt) {
  split(i,doctors,";");}
  END{print doctors[1]}'
  </code></pre>
  
  <p>When I run it, I get </p>
  
  <pre><code>awk: 3: unexpected character '''
  awk: 5: unexpected character '''
  </code></pre>
  
  <p>Could someone help me with this please?</p>