title: Ignore first and last line in file
body: <p>I'm trying to replace characters in certain columns of multiple text files using PowerShell. I have it working perfectly except that I need to ignore the first and the last row in each file and I can't get that to work.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>$Location = "C:\Users\gerhardl\Documents\Tenacity\TEMP\POWERSHELL TESTS"
  $Data = "$Location\*.TXT"
  $Output = "$Location\Fixed"
  
  Get-Item $Data |
      ForEach-Object {
          $file = $_
          $_ | 
              Get-Content | 
              ForEach-Object {
                  $Beginning = $_.Substring(0,105)
                  $Account = $_.Substring(105,20) -replace "[ABCDEFGHIJKLMNOPQRSTUVWXYZ]", " "
                  $End = $_.Substring(125)
                  '{0}{1}{2}' -f $Beginning,$Account,$End
              } |
              Set-Content -Path (Join-Path $Output  $file.Name)
  
      }
  </code></pre>
  
  <p>I know there are similar threads, but it seems that my For Each loop doesn't play well with those suggestions.</p>