title: Extract multiple strings with awk
body: <p>I'm trying to extract two strings from each line, some lines don't have either string, some line has one string.</p>
  
  <p>My input input.txt:</p>
  
  <pre><code>ID=MD001;refer=init;loc=tap2
  ID=MD002;Name=Jam;refer=init;loc=tap2
  ID=MD003;Name=Jane;Value=vip;refer=init;loc=tap2
  ID=MD008;Name=George;product=car;vall=some;Value=vim;refer=init;loc=tap2
  ID=MD0010;product=cars;Value=vip4;refer=init;loc=tap2
  ID=MD0018;product=cars;
  ...
  </code></pre>
  
  <p>I want to match string "Name" or/and "Value", and output them out as:</p>
  
  <pre><code>ID=MD002 Name=Jam
  ID=MD003 Name=Jane Value=vip
  ID=MD008 Name=George Value=vim
  ID=MD0010 Value=vip4
  </code></pre>
  
  <p>I tried:</p>
  
  <p><code>head input.txt | awk '$1 ~ /Name|Value/ {match($1, /(ID=*);.*(Name*);.*(Value.*)/, name); print name[1] name[2] name[3]}'</code></p>
  
  <p>But it did print anything.
  Thanks for the help.</p>