我有一个包含以下内容的文本文件:
blah, blah, blah ...
Text : {string1, string2, string3,
string4, string5, string6,}
blah, blah, blah ...
Text : {string7, string8, string9,
string10, string11, string12,}
我想只将大括号之间的行合并为一行,如下所示:
blah, blah, blah ...
Text : {string1, string2, string3, string4, string5, string6,}
blah, blah, blah ...
Text : {string7, string8, string9, string10, string11, string12,}
但是,我不想将更改应用于整个文本文件,因为它包含其他内容。我只想编辑大括号 { ... } 之间的文本。我搞砸了,-join
但无法让它工作。我有以下脚本可以打开文件、进行更改并输出到另一个文件中:
gc input.txt |
# Here I have several editing commands, like find/replace.
# It would be great if I could add the new change here.
sc output.txt
谢谢!