title: Parse through text file and write out data
body: <p>I'm working on the first steps towards creating a powershell script that will read through printer logs (probably using get-WMI cmdlet), and parse through the logs. Afterwards, I plan on having the script output to a .txt file the name of the printer, a counter of the number of times a printer was used (if possible), and specific info found in the logs.</p>
  
  <p>In order to do this, I've decided to try working backwards. Below is a small portion of what the logs will look like:</p>
  
  <pre><code>10         Document 81, A361058/GPR0000151814_1: owned by A361058 was printed on R3556 via port IP_***.***.***.***.  Size in bytes: 53704; pages printed: 2                                                                  20130219123105.000000-300  
  10         Document 80, A361058/GPR0000151802_1: owned by A361058 was printed on R3556 via port IP_***.***.***.***.  Size in bytes: 53700; pages printed: 2   
  </code></pre>
  
  <p>Working backwards and just focusing on parsing first, I'd like to be able to specifically get the "/GRP", "R3446 (in general, R*<em>*</em> as this is the printer name)", and get a counter that shows how often a specific printer appeared in the log files.</p>
  
  <p>It has been a while since I last worked with Powershell, however at the moment this is what I've managed to create in order to try accomplishing my goal:</p>
  
  <pre><code>Select-String -Path "C:\Documents and Settings\a411882\My Documents\Scripts\Print Parse Test.txt" -Pattern "/GPR", " R****" -AllMatches -SimpleMatch 
  </code></pre>
  
  <p>The code does not produce any errors, however I'm also unable to get any output to appear on screen to see if I'm capturing the /GRP and printer name. At the moment I'm trying to just ensure I'm gathering the right output before worrying about any counters. Would anyone be able to assist me and tell me what I'm doing wrong with my code? </p>
  
  <p>Thanks!</p>
  
  <p>EDIT: Fixed a small error with my code that was causing no data to appear on screen. At the moment this code outputs the entire two lines of test text instead of only outputting the /GPR and server name. The new output is the following:</p>
  
  <pre><code>My Documents\Scripts\Print Parse Test.txt:1:10         Document 81, A361058/GPR0000151814_1: owned by A361058 was printed on
   R3556 via port IP_***.***.***.***.  Size in bytes: 53704; pages printed: 2                                                  
                  20130219123105.000000-300  
  My Documents\Scripts\Print Parse Test.txt:2:10         Document 80, A361058/GPR0000151802_1: owned by A361058 was printed on
   R3556 via port IP_***.***.***.***.  Size in bytes: 53700; pages printed: 2  
  </code></pre>
  
  <p>I'd like to try having it eventually look something like the following:</p>
  
  <pre><code>/GPR, R****, count: ## (although for now I'm less concerned about the counter)
  </code></pre>