【发布时间】:2021-10-24 10:39:22
【问题描述】:
我有如下配置 yml 文件..我想在匹配字符串“logs:”后复制所有行直到文件末尾
# numberof Threads
encryptionKey: "abcd"
logs:
- displayName: "RLM_Failure"
logDirectory: "/optware/msste/legaluat/log"
logName: "DSSErrors.log"
searchStrings:
#displayName Should be unique across the patterns including the case.
- displayName: "RLM_Dependency"
pattern: "Merge fails entirely because needed objects"
matchExactString: false
caseSensitive: false
我试过这个命令
Select-String "^logs: "/path/old/config.yml -Context 0, 100 |
% {$_.Context.PostContext} |
Add-Content "/path/new/config.yml"
但是这只是在匹配字符串之后处理 100 行......无论如何我可以在不指定行号的情况下实现。
【问题讨论】: