本帖最后由 WHY 于 2022-10-23 11:23 编辑
- sed -r -n "/>楼主:?</{n;p}" a.txt > b.txt
复制代码
- gawk "a~/>楼主:?</{print};{a=$0}" a.txt > b.txt
复制代码
- PowerShell "sc -Literal '%~dp0b.txt' $(forEach( $s In (gc -Literal '%~dp0a.txt' -Read 0) ){ if($a -match '>楼主:?<'){$s} $a=$s })"
复制代码
- PowerShell "gc -Literal '%~dp0a.txt' | Select-String '>楼主:?<' -Context 1 | forEach{ $_.Context.PostContext } | sc -Literal '%~dp0b.txt'"
复制代码
|