You need to deserialize your CSV text into objects with properties that can be referenced. Then you can compare the Name
property. You can do the following if all your csv files have the same headers.
Get-ChildItem -Filter "*Results.csv" | Import-Csv |
Where-Object {$_.NAME -eq "Cage,Johnny"} |
Export-Csv "test.csv"
If your CSV files contain different headers, then you have a couple of options. One, you could create your output CSV with all possible headers that exist across all files (or just the headers you want as long as they are the same across all files). Second, you could just output your data rows and have a broken CSV.
# Broken CSV Approach
Get-ChildItem -Filter "*Results.csv" | Import-Csv |
Where-Object {$_.NAME -eq "Cage,Johnny"} | Foreach-Object {
$_ | ConvertTo-Csv -Notype | Select-Object -Skip 1
} | Add-Content test.csv
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…