首页 > 解决方案 > 使用 powershell 在两个部分之间更新文本文件

问题描述

我想检查 [section3] 和 [section4] 之间的文本并在第 4 行之后插入一个新行。我如何使用 powershell 来做到这一点,有什么指针可以做到这一点吗?

样本.txt

 [Section1]
 around 100Lines of text
[Section2]
 around 100Lines of text
[Section3]
Line1
Line2
Line3
Line4
Line5
Line6
[Section4]
100Lines of test
[Section5]

标签: stringpowershell

解决方案


推荐阅读