我有多个文件,其中包含以下内容:
this is a test1
{
test 123
test 456
test 789
}
this is a test2
{
test 123
test 456
test 789
}
this is a test3
{
test 123
test 456
test 789
}
Run Code Online (Sandbox Code Playgroud)
需要删除一段:
this is a test2
{
test 123
test 456
test 789
}
Run Code Online (Sandbox Code Playgroud)
大括号之间的行可能不同(更少或更多行)我尝试过类似的方法:
sed -i 's|This is a test2 *.* !}||g' *
Run Code Online (Sandbox Code Playgroud)
和
sed -i 's|This is a test2, !}||g' *
Run Code Online (Sandbox Code Playgroud)
但没有成功