String 使用powershell在两个节之间使用更新文本文件

String 使用powershell在两个节之间使用更新文本文件,string,powershell,String,Powershell,我想检查[section3]和[section4]之间的文本,并在第4行之后插入新行。 我如何使用powershell实现这一点,有什么建议吗 Sample.txt [Section1] around 100Lines of text [Section2] around 100Lines of text [Section3] Line1 Line2 Line3 Line4 Line5 Line6 [Section4] 100Lines of test [Section5] 你在分析INI

我想检查[section3]和[section4]之间的文本,并在第4行之后插入新行。 我如何使用powershell实现这一点,有什么建议吗

Sample.txt

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

你在分析INI文件吗?@vonPryz:是的,这回答了你的问题吗?尝试专门的解决方案,而不是滚动自己的解决方案。