SED find and replace xml


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <Student>
  2. <StudentId>E687</StudentId>
  3. <ClassId>12</ClassId>
  4. <Amount>50</Amount>
  5. <Location>AR</Location>
  6. </Student>
  7.  
  8.  
  9. #Change 50 to 100
  10. sed 's#\(<Amount>\)[0-9]*\(</Amount>\)#\1'100'\2#g' test.xml

URL: http://unstableme.blogspot.com/2010/01/replace-values-in-xml-using-sed-and-awk.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.