简体   繁体   中英

how to edit and delete the xml attributes using shell script in mac

i want to edit the following xml file attribute ios-CFBundleversion and android-Versioncode with variable $version-$date and delete the version attribute or version attribute value?

 <widget android-versionCode="20102" id="com.cricket.ade" ios-CFBundleVersion="20102" version="1.1" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>CreadApp</name>

Here the ios-CFbundleversion and android-versionCode have to be replaced with variables like $version-$date and version attribute should be either deleted for one xml file and version attribute should be version="" for another xml file.

Pleaase help me out

I have tried this before... it doesnt work

 sed -E 's/name="[^"]*"/ios-CFBundleversion="$VERSION-$SVNREV-$SVNDATE"/' config.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM