4 deleted 20 characters in body
source | link

Using XMLStarlet, you could delete all the string nodes under the root node whose name attribute doesis not contain the value profile:

$ xml ed -d '/resource/string[@name != "profile"]' string.xml
<?xml version="1.0"?>
<resource>
  <string name="profile">My Profile</string>
</resource>

Add -O after ed if you don't want the XML declaration line.

Using XMLStarlet, you could delete all the string nodes under the root node whose name attribute does not contain the value profile:

$ xml ed -d '/resource/string[@name != "profile"]' string.xml
<?xml version="1.0"?>
<resource>
  <string name="profile">My Profile</string>
</resource>

Add -O after ed if you don't want the XML declaration line.

Using XMLStarlet, you could delete all the string nodes under the root node whose name attribute is not profile:

$ xml ed -d '/resource/string[@name != "profile"]' string.xml
<?xml version="1.0"?>
<resource>
  <string name="profile">My Profile</string>
</resource>

Add -O after ed if you don't want the XML declaration line.

3 deleted 5 characters in body
source | link

Using XMLStarlet, you could delete all the string nodes under the root node that whose name attribute does not contain the value profile:

$ xml ed -d '/resource/string[@name != "profile"]' string.xml
<?xml version="1.0"?>
<resource>
  <string name="profile">My Profile</string>
</resource>

Add -O after ed if you don't want the XML declaration line.

Using XMLStarlet, you could delete all the string nodes under the root node that whose name attribute does not contain the value profile:

$ xml ed -d '/resource/string[@name != "profile"]' string.xml
<?xml version="1.0"?>
<resource>
  <string name="profile">My Profile</string>
</resource>

Add -O after ed if you don't want the XML declaration line.

Using XMLStarlet, you could delete all the string nodes under the root node whose name attribute does not contain the value profile:

$ xml ed -d '/resource/string[@name != "profile"]' string.xml
<?xml version="1.0"?>
<resource>
  <string name="profile">My Profile</string>
</resource>

Add -O after ed if you don't want the XML declaration line.

2 deleted 3 characters in body
source | link

Using XMLStarlet, you could delete all the string nodes under the root node that whose name attribute does not contain the value profile:

$ xml ed -t -d '/resource/string[@name != "profile"]' string.xml
<?xml version="1.0"?>
<resource>
  <string name="profile">My Profile</string>
</resource>

Add -O after ed if you don't want the XML declaration line.

Using XMLStarlet, you could delete all the string nodes under the root node that whose name attribute does not contain the value profile:

$ xml ed -t -d '/resource/string[@name != "profile"]' string.xml
<?xml version="1.0"?>
<resource>
  <string name="profile">My Profile</string>
</resource>

Add -O after ed if you don't want the XML declaration line.

Using XMLStarlet, you could delete all the string nodes under the root node that whose name attribute does not contain the value profile:

$ xml ed -d '/resource/string[@name != "profile"]' string.xml
<?xml version="1.0"?>
<resource>
  <string name="profile">My Profile</string>
</resource>

Add -O after ed if you don't want the XML declaration line.

1
source | link