Simple edit example needed

Help
skim
2005-04-22
2013-03-13
  • skim

    skim - 2005-04-22

    I have the following XML file, edit.xml.

    <?xml version=...>
    <market>
    <fruit>
    <ftype>apple</ftype>
    <price>1.00</price>
    <quantity>100</quantity>
    </fruit>
    <fruit>
    <ftype>pear</ftype>
    <price>1.20</price>
    <quantity>75</quantity>
    </fruit>
    <fruit>
    <ftype>banana</ftype>
    <price>0.50</price>
    <quantity>500</quantity>
    </fruit>
    </market>

    How would go I go about updating the price for pear to 1.50?  Thanks!

     
    • Mikhail Grushinskiy

      xml ed -u "/market/fruit/ftype[text()='pear']/../price" -v 1.50 edit.xml

      --MG

       
    • skim

      skim - 2005-04-25

      Thank you, Mikhail.  That is exactly what I need :)

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks