小编van*_*191的帖子

如何选择字符串多行?

我正在尝试Select-String使用多行文本。

例子:

 "This is line1
 <Test>Testing Line 2</Test>
 <Test>Testing Line 3</Test>"
Run Code Online (Sandbox Code Playgroud)

我希望能够在Select-String. 但是,它仅在我执行时选择第一行Select-String -Pattern "Line1"。如何将所有 3 行提取在一起?

Select-String -Pattern "Line1"
Run Code Online (Sandbox Code Playgroud)

powershell select-string

6
推荐指数
2
解决办法
8978
查看次数

标签 统计

powershell ×1

select-string ×1