Posted By

moonbather on 11/21/10


Tagged

sed


Versions (?)

SED find and replace xml


 / Published in: Bash
 

URL: http://unstableme.blogspot.com/2010/01/replace-values-in-xml-using-sed-and-awk.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

Report this snippet  

You need to login to post a comment.