title: Aligning Output of Select-String in PowerShell
body: <p>When I use <code>select-string</code> I almost always want my output aligned, i.e. the file names, the line numbers, and the found text should all be aligned into columns. Visually it is much less distracting and usually allows spotting discrepancies much more easily. As a trivial example I have injected an extra space in the middle file here:</p>
  
  <pre><code>PS&gt; Get-ChildItem *.cs | Select-StringAligned -pattern override
  ---
  FileWithQuiteALengthyName.cs  : 34:    protected override void Foo()
  ShortName.cs                  : 46:    protected override void  Bar()
  MediumNameFileHere.cs         :123:    protected override void Baz()
  ---
  </code></pre>
  
  <p>Unfortunately, <code>Select-String</code> does not do that; in reality it gives this--can you spot the extra space here?</p>
  
  <pre><code>PS&gt; Get-ChildItem *.cs | Select-String -pattern override
  ---
  FileWithQuiteALengthyName.cs:34:    protected override void Foo()
  ShortName.cs:46:    protected override void  Bar()
  MediumNameFileHere.cs:123:    protected override void Baz()
  ---
  </code></pre>
  
  <p>Is there a way to force <code>Select-String</code> to align its output columns?</p>
  
  <p>EDIT:
  Oops! I forgot one important part: I would like to also include the <code>-Context</code> parameter if possible so one could get an arbitrary number of lines before and after the match.</p>