我正在尝试使用选择字符串来过滤以完全为子字符串结尾的字符串,但是我无法获得预期的结果。
示例模式为“标题:金额”
Get-Content $TestFile |
Select-String -Pattern "Caption:Amount" -CaseSensitive |
Set-Content $NewFile
1. ABC Caption:Amount 2. BCD Caption:Amount Including VAT 3. XYZ Caption:Amount 4. PQR Caption:Amount Excluding VAT
我的预期结果仅为1.和3.,但显示所有4行