linux - find matching text and replace next line -


i'm trying find line in file , replace next line specific value. tried sed, seems not \n. how else can done?

the file looks this:

<key>connectionstring</key> <string>anything_could_be_here</string> 

and i'd change this

<key>connectionstring</key> <string>changed_value</string> 

here's tried:

sed -i '' "s/<key>connectionstring<\/key>\n<string><\/string>/<key>connectionstring<\/key>\n<string>replaced_text<\/string>/g" /path/to/file 

this might work (gnu sed):

sed '/<key>connectionstring<\/key>/!b;n;c<string>changed_value</string>' file 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -