summaryrefslogtreecommitdiff
path: root/scripts/remove_entity.sh
blob: 66a38235b61638efdb1ec7b2613b42fd47ab5e7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
if [ -z "$1" ]; then 
	echo "$0 <Filename / part of to remove>"
	exit
fi

echo "---------------------"
grep $1 *.mxml sp-with-simplesign
echo "---------------------"
echo -n "OK to remove ? [Y/n]"
read x
case $x in 
	"Y"|"y"|"") ;;
	 *) exit 1 ;;
esac

echo
if [ `uname -s` == "Darwin" ]; then
	MacOSX = true
fi
if (grep -q $1 sp-with-simplesign); then
	if ( $MacOSX ) ; then
		sed -i "" "/$1/d" sp-with-simplesign
	else
		sed -i "/$1/d" sp-with-simplesign
	fi
fi
grep $1 *.mxml | sed 's/.*:  <xi:include href="\(.*\)"\/>/\1/' | while read file ; do
	git rm $file
done

grep $1 *.mxml | sed 's/\(.*\.mxml\):  <xi:include href=".*"\/>/\1/' | while read file ; do
	if ( $MacOSX ) ; then
		sed -i "" "/$1/d" $file
	else
		sed -i "/$1/d" $file
	fi
done
git diff