Skip to content

Instantly share code, notes, and snippets.

@int02h
Created August 12, 2016 11:47
Show Gist options
  • Save int02h/d0a0d3af866d8605bbc60800a9a7372b to your computer and use it in GitHub Desktop.
Save int02h/d0a0d3af866d8605bbc60800a9a7372b to your computer and use it in GitHub Desktop.
Remove Android resource string from all strings.xml
#!/bin/sh
help() {
echo "Usage: ./delete-string.sh PATH_TO_RES_FOLDER STRING_NAME"
echo "Where:"
echo " PATH_TO_RES_FOLDER - path to project resource directory"
echo " STRING_NAME - string name"
echo ""
}
if [ $# != 2 ]
then
echo "Not enough arguments\n"
help
exit 1
fi
RES_PATH=$1
STRING_NAME=$2
FILES=$(find $RES_PATH -name strings.xml)
for f in $FILES; do
echo "Removing '$2' string from '$f' - \c"
sed -i "" "/name=\"$STRING_NAME\"/d" "$f"
echo "Done"
done
@int02h
Copy link
Author

int02h commented Aug 12, 2016

Tested on OS X El Capitan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment