2
使用 powershell 获取文件部分内容
source link: https://www.v2ex.com/t/821017
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
彭于晏们,如何使用 powershell 获取 txt 中部分内容,其中红框区域的内容是动态变化的,今天是 4 条,明天可能是 3 条。
9 条回复 • 2021-12-09 10:36:33 +08:00
kokutou 1 天前 via Android
按行读取,
到了 summary 开始记录
到了空行停止。。。
不就行了。。。
到了 summary 开始记录
到了空行停止。。。
不就行了。。。
skinny 1 天前
Get-Content -Path MyConmandOutput.txt | Select-Object -First 20 -Skip 4 | Select-String -Pattern '^(Error|Warning) ->\d+'
不过如果是我自己写,我不会为了一行而一行,我会用循环……
不过如果是我自己写,我不会为了一行而一行,我会用循环……
skinny 1 天前
Get-Content -Path MyConmandOutput.txt | Select-Object -First 20 -Skip 4 | Select-String -Pattern '^(Error|Warning) -?\d+'
ladypxy 1 天前
全部读取了然后用正则表达式匹配呗
CallMeReznov 23 小时 38 分钟前
如果段落格式是固定的就按照换行符匹配呗
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK