$input_path = "d:\txt\*.txt"
$output_file = 'd:\out.txt'
$regex = "\w* (\w\.? )?\w* (was )?[B|b]orn .{100}"
select-string -Path $input_path -Pattern $regex -AllMatches | % { $_.Matches } | % { $_.Value } > $output_file
Powershell beginner here. I'd like it to loop through all files in a specific directory, search for a specific regex pattern and output the results to a file. So far I've managed to work out the above. How can I have it also output the filename for each match?