code:
foreach ($line in Get-Content -path .\test.sql) {
if ($line -match 'bdw_\w*.\w*') {
write-output $matches[0]}}
Ideas:
-
Read the file and iterate through
foreach ($line in Get-Content -path .\test.sql) -
Regular matching
if ($line -match 'bdw_\w*.\w*')
This match will output True or False, you need to use $matches output -
output
{write-output $matches[0]}}
Tips1:
If necessary, you can flexibly modify the regular matching method.
Modify this -> 'bdw_\w*.\w*'
Tips2:
If you need to output to a file, add > filename.txt at the end