title: Set of data needs to be rearranged and exported as CSV
body: <p>I have a set of data and it needs to be rearranged with header. PowerShell is a quick way, I think, to do this.</p>
  
  <p>The data as an example:</p>
  
  <pre>
  AAA,
  123,53,145,
  text1 text12,text2,23.00,
  21,6,0.21,0.00,2,
  1,321,4
  BBB,1,421,5,
  text3 text34,
  text4,41,22.5,1,
  23,674,75,8,5....
  </pre>
  
  <p>As you can see the ',' seperates the values and the dot is just part of the value. The AAA and BBB represent the names and the values for AAA are before BBB. I expect the values to be like this within CSV file with each value in a new cell:</p>
  
  <pre>
  Name: AAA
  abc:  123
  def: 53
  ghi: 145
  jkl: text1 text12
  mno: text2
  pqr: 23.00
  stu: 21
  vwx: 6
  yz: 0
  </pre>
  
  <p>Or the header would be like: Name abc def etc. and the values in the next cell under the header.</p>
  
  <p>In total there are 16 values separated by a comma for one name (ex. AAA). There are maybe hundreds of names with random values.</p>
  
  <p>I didn't get the result with <code>Sort-Object</code>, because it would scan the data and put the values in random order.</p>