0
首先,问一个非常简单的问题,因为我是全新的PowerShell的同学。如果搜索字符串匹配,只能读取PowerShell中的特定字词
我有文件,如:
"your>desired>output" START: this is th
e output
next line
next line
"your>desired>output" START: this is th
e output
如果“期望”这个词被发现,不是只读“产出”比 “这是输出”
如果我使用
我的任务是Select-String *.txt -pattern "desired"
大于输出是
"your>desired>output" START: this is th
“电子输出”丢失。
任何形式的帮助表示赞赏。谢谢。
'选择字符串* .TXT “期望” -Context 1 |%{$ _线。 $ _。Context.PostContext}' –
@ MathiasR.Jessen检查一个关于上下文的欺骗,但你也可以做出答案(当然有一点解释) – Matt
@ MathiasR.Jessen谢谢你的回应,但这并没有返回任何东西...... :(显示为错误,我在“期望”之前使用了额外的模式 – user6633897