title: Use list of files saved in text file to search for string in powershell
body: <p>I have 2 sets of operations, in the 1st one I look for files that contain a string, then in second one I use that list to extract lines that contains another string and then edit them.</p>
  
  <pre><code>$List_Of_Files = Get-ChildItem "$outputfolder*.html" -recurse | 
    Select-String -pattern "https://www.youtube.com" | group path | 
      select name -ExpandProperty Name
  
  $List_Of_Titles = @(Get-Content $List_Of_Files | Where-Object { $_.Contains("&lt;title&gt;") }) | 
    Foreach-Object {
      $content = $_ -replace "    &lt;title&gt;", "  &lt;video:title&gt;";
      $content -replace "&lt;/title&gt;", "&lt;/video:title&gt;"
    }
  </code></pre>
  
  <p>Code works as expected, but the problem is that I need the 1st set of operations to output results into a text file and then use that file in second set which should also output results into another text file.</p>
  
  <p>I have tried the following, but second set doesn't create the file, but doesn't give me any error either.</p>
  
  <pre><code>Get-ChildItem "$outputfolder*.html" -recurse | 
    Select-String -pattern "https://www.youtube.com" | group path | 
      select name -ExpandProperty Name | Set-Content "c:\List_Of_Files.txt"
  
  @(Get-Content "c:\List_Of_Files.txt" | Where-Object { $_.Contains("&lt;title&gt;") }) |
   Foreach-Object {
      $content = $_ -replace "    &lt;title&gt;", "  &lt;video:title&gt;";
      $content -replace "&lt;/title&gt;", "&lt;/video:title&gt;"
   } | Set-Content "c:\list_of_titles.txt"
  </code></pre>
  
  <p>I have tried to modify it in different ways, but can't figure out how to make it work.</p>