title: How do I select multiple columns and expand properties using powershell select-string -Allmatch?
body: <p>I'm searching a collection of text files (*.sql) for the occurrence of 8 digit numbers that begin with a 9.  There could be multiple instances of these numbers in the file as well as multiple instances on each line in the file.  I only want the output to display the unique occurrence of each 8 digit number in each file.  This is what I have so far:</p>
  
  <pre><code>Select-String "9[0-9]{8}" "*.sql" -AllMatches | Select-Object FileName, @{N="Value";E={ $_.matches |  %{$_.groups[0].value}}} | Select-Object  -unique FileName,Value  
  </code></pre>
  
  <p>And my output look like this:</p>
  
  <pre><code>FileName                       Value
  --------                       -----
  
  File1.sql                      907520714
  File1.sql                      {907500507, 907520700, 907520701, 907520703...} 
  File1.sql                      {907520725, 907520727, 907520728, 907520729} 
  File1.sql                      990140600
  File2.sql                      990319161
  File2.sql                      {990603919, 990603925, 990603926} 
  File2.sql                      {991100103, 991100103}
  File2.sql                      {990700023, 990700504, 990700521, 990740520...} 
  File3.sql                      907500044
  </code></pre>
  
  <p>etc....</p>
  
  <p>What I would like to do is expand the arrays so that when I pipe it through select -unique 
  I actually will only get the unique 8 digit numbers contained in each file.</p>
  
  <p>This is what I would like:</p>
  
  <pre><code>FileName                       Value
  --------                       -----
  
  File1.sql                      907520714
  File1.sql                      907500507
  File1.sql                      907520700
  File1.sql                      907520701
  File1.sql                      907520703 
  File1.sql                      907520725
  File1.sql                      907520727
  File1.sql                      907520728
  File1.sql                      907520729 
  File1.sql                      990140600
  File2.sql                      990319161
  File2.sql                      990603919
  File2.sql                      990603925
  File2.sql                      990603926 
  File2.sql                      991100103
  File2.sql                      990700023
  File2.sql                      990700504
  File2.sql                      990700521
  File2.sql                      990740520 
  File3.sql                      907500044
  </code></pre>
  
  <p>etc...</p>
  
  <p>How can I do this? And can my current powershell command be improved? </p>
  
  <p>Thanks!</p>