title: How to convert a text file into csv using AWK
body: <p>I am collecting usb usage details of all users and convert it into CSV files so that I can export it into some database. 
  The input text file is as follows:- </p>
  
  <pre><code>USB History Dump
  by nabiy (c)2008 
  (1) --- Kingston DataTraveler 130 USB Device 
  instanceID: 0018F3D974B4A9C0E1760896&amp;0
  ParentIdPrefix: 7&amp;b62e00e&amp;2
  Last Mounted As: \DosDevices\I:
  Driver:{4D36E967-E325-11CE-BFC1-08002BE10318}\0033
  Disk Stamp: 09/07/2010 15:07
  Volume Stamp: 09/07/2010 15:07 
  (2) --- Kingston DataTraveler 2.0 USB Device 
  instanceID: 001D0F1E35B25B8C1201011B&amp;0
  ParentIdPrefix: 7&amp;1f5848f3&amp;0
  Driver:{4D36E967-E325-11CE-BFC1-08002BE10318}\0035
  Disk Stamp: 09/06/2010 15:18
  Volume Stamp: 09/06/2010 15:18 
  (3) --- Maxtor OneTouch III USB Device 
  instanceID: 044303E5&amp;0
  ParentIdPrefix: 
  Driver:{4D36E967-E325-11CE-BFC1-08002BE10318}\0032
  Disk Stamp: 09/10/2010 10:09
  Volume Stamp: 03/12/2010 10:42 
  </code></pre>
  
  <p>How can I parse this file so that I can get in following format:</p>
  
  <pre><code>hostname Devic_name instanceID ParentPrefix LastMountedAs Driver 
  pcname kingston xxxx xxxxxxxxx xxxxxxxxxx xxxxxxxx
  pcname maxtor 0440xxx 4 d 367 08/07/2010 xxxxxxxx
  pcname kingston xxxxxxx xxxxxxx xxxxxxxxx xxxxxxxx
  </code></pre>
  
  <p>The pc name will be taken from hostname command.</p>
  
  <p>The output desired is in CSV format for database with some batch or awk script.
  Any suggestion is greatly appreciated.</p>