title: Explode to Array
body: <p>I put together this shell script to do two things:</p>
  
  <ol>
  <li>Change the delimiters in a data file ('::' to ',' in this case)</li>
  <li>Select the columns and I want and append them to a new file</li>
  </ol>
  
  <p>It works but I want a better way to do this.  I specifically want to find an alternative method for exploding each line into an array.  Using command line arguments doesn't seem like the way to go.  ANY COMMENTS ARE WELCOME.</p>
  
  <pre><code>    # Takes :: separated file as 1st parameters
      SOURCE=$1
  
      # create csv target file
      TARGET=${SOURCE/dat/csv}
      touch $TARGET
  
      echo #userId,itemId &gt; $TARGET
  
      IFS=","
      while read LINE
      do
          # Replaces all matches of :: with a ,
          CSV_LINE=${LINE//::/,}
          set -- $CSV_LINE
          echo "$1,$2" &gt;&gt; $TARGET
      done &lt; $SOURCE
  </code></pre>