Original file:
bla bla test
blabla
start
test
blabla
start
test
The result should be:
bla bla test
blabla
start
edit
blabla
start
edit
So after the first occurence of "start" all "test" should be replaced with "edit"
答案 0 :(得分:2)
You can use this sed:
sed '/start/,$s/test/edit/g' file
bla bla test
blabla
start
edit
blabla
start
edit
Explanation:
/start/,$ # find text from first occurrance of start till end
s/test/edit/g # in the found text replace test by edit globally