Hello experts, I know line number of the word I want to replace. Can "sed" substitute word on a specific line? As well, can sed substitute words inside a specific patten. ex. <word>lalala</word> #replace anything between <word> and </word>
minifish
1)
sed -e "<line number>s/<search pattern>/<replacement string>/"
e.g. replace on line 4 the word "bike" by "car"
sed -e "4s/bike/car/"
2) sed -e "s%\(<word>\).*\(</word>\)%\1<replacement string>\2%" % is used instead of / so the / in front of the 2nd "word" doesnt need to be escaped.
or with / sed -e "s/\(<word>\).*\(<\/word>\)/\1<replacement string>\2/"
thank you exper:D:b: