title: How can I search the first line and the last line in a text file?
body: <p>I need to only search the 1st line and last line in a text file to find a "-" and remove it.
  How can I do it? 
  I tried select-string, but I don't know to find the 1st and last line and only remove "-" from there.</p>
  
  <p>Here is what the text file looks like:</p>
  
  <pre><code> % 01-A247M15 G70 
  N0001 G30 G17 X-100 Y-100 Z0
  N0002 G31 G90 X100 Y100 Z45
  N0003 ; --PART NO.:  NC-HON.PHX01.COVER-SHOE.DET-1000.050 
  N0004 ; --TOOL:  8.55 X .3937 
  N0005 ;  
  N0006  % 01-A247M15 G70 
  </code></pre>
  
  <p>Something like this?</p>
  
  <pre><code>$1 = Get-Content C:\work\test\01.I
  
  $1 | select-object -index 0, ($1.count-1)
  </code></pre>