ログファイルからいくつかのエラーを別のファイルに抽出しています。出力ファイルを上書きしますか?
私が探しているエラーは、小さなブロックで定義されています。
#Define all the error types that we need to search on
$error_6="Missing coded entry in table for provider sector category record"
$error_7="not a well-formed email address"
$error_8="Org Id must not contain invalid characters"
$error_9="Missing sub type code for provider type category record"
$error_10="Provider sub type"
次に、ソースログファイルを読み込み、一致する行を削除します。
別のファイルにそれらをダンプすると、各ファイルに正しい行数が得られますが、同じファイルを使用すると1行しか得られません。私はそれがファイルに追加されると思った。
(出力の唯一の1行)は動作しません
(Get-Content $path\temp_report.log) | Where-Object { $_ -match $error_6 } | Set-Content $path\known_errors.log
(Get-Content $path\temp_report.log) | Where-Object { $_ -match $error_7 } | Set-Content $path\known_errors.log
(Get-Content $path\temp_report.log) | Where-Object { $_ -match $error_8 } | Set-Content $path\known_errors.log
(Get-Content $path\temp_report.log) | Where-Object { $_ -match $error_9 } | Set-Content $path\known_errors.log
(Get-Content $path\temp_report.log) | Where-Object { $_ -match $error_10 } | Set-Content $path\known_errors.log
作品(合計出力の16行)
(Get-Content $path\temp_report.log) | Where-Object { $_ -match $error_6 } | Set-Content $path\known_errors_6.log
(Get-Content $path\temp_report.log) | Where-Object { $_ -match $error_7 } | Set-Content $path\known_errors_7.log
(Get-Content $path\temp_report.log) | Where-Object { $_ -match $error_8 } | Set-Content $path\known_errors_8.log
(Get-Content $path\temp_report.log) | Where-Object { $_ -match $error_9 } | Set-Content $path\known_errors_9.log
(Get-Content $path\temp_report.log) | Where-Object { $_ -match $error_10 } | Set-Content $path\known_errors_10.log
あなたが変更することによって、あなたの[前の質問]への「一致」の答えを「一致しない」ことを実現します(http://stackoverflow.com/q/ 38405279/1630171)もこれに対応していますか? –