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
Post a Comment