summaryrefslogtreecommitdiffstats
path: root/admin/sedfiles.sh
blob: 00cf942f3ca04dcadb9cb524476ec827d380fed6 (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
#!/bin/bash

if test -z "$*"; then
	echo "No files to parse"
	exit
fi


SEARCH="contextStackSize"
REPLACE="actualStackSize"

echo "Searching for $SEARCH"
echo "Replacing with $REPLACE"

for afile in $*; do
	DATA=`grep "$SEARCH" $afile`

	if test -n "$DATA"; then

		echo "Processing $afile ..."

		rm -f $afile.backup
		rm -f $afile.backup2

		cp $afile $afile.backup

		COMMAND="s/$SEARCH/$REPLACE/g"
		echo "`cat $afile.backup | sed -e $COMMAND`" > $afile

		if grep "$SEARCH" $afile; then
			echo "Ops.. maybe it didn't work..."
		else
			echo "Ok, it worked."
		fi
	fi

done