1. 括号在同一行
# cat test2
good morning (good afternoon) (good evening) (good
good) (good morning)
# cat sed2.len
s/([^)]*)/AAA/g
# sed -f sed2.len test2
good morning AAA AAA (good
good) AAA
2. 括号跨行
# cat sed3.len
s/([^)]*)/AAA/g
/(.*/{
N
s/([^)]*)/AAA/g
P
D
}
# sed -f sed3.len test2
good morning AAA AAA AAA AAA