title: Removing Parts of a File Name based on a Delimiter
body: <p>I have various file names that are categorized in two different ways. They either just have a code like: "866655" or contain a suffix and prefix "eu_866655_001". My hope is to write to a text file the names of files in the same format. I cannot figure out a successful method for removing the suffix and prefix.</p>
  
  <p>Currently this what I have in my loop in Powershell:</p>
  
  <pre><code>$docs = Get-ChildItem -Path $source | Where-Object {$_.Name -match '.doc*'}
  
  if ($docs.basename -contians 'eu_*')
  {
   Write-Output ([io.fileinfo]"$doc").basename.split("_")
  }
  </code></pre>
  
  <p>I'm hoping to turn "eu_866655_001" into "866655" by using "_" as the delimiter. </p>
  
  <p>I'm aware that the answer is staring me down but I still can't seem to figure it out.</p>