1#!/bin/sh
2#-----------------------------------------------------------------------------
3#-- Name:        docs/mac/M5replace.sh
4#-- Purpose:     Replace a string in CodeWarrior exported XML project files
5#-- Author:      Gilles Depeyrot
6#-- Modified by:
7#-- Created:     08.01.2002
8#-- RCS-ID:      $Id: M5replace.sh 15373 2002-05-04 14:19:09Z GD $
9#-- Copyright:   (c) 2001 Gilles Depeyrot
10#-- Licence:     wxWindows licence
11#-----------------------------------------------------------------------------
12
13echo -n "Replace '$1' with '$2' in xml project files? [y/N]"
14read ans
15
16if [ "$ans" != "y" ] ; then
17    exit
18fi
19
20echo "Searching for xml files..."
21files=`find ../.. -name "*.xml" -print`
22
23for f in $files
24do
25    cat $f | sed -e "s,$1,$2," > $f.new
26    if [ "`diff -q $f $f.new`" != "" ] ; then
27        mv $f.new $f
28        echo "Replaced in $f..."
29    else
30        rm $f.new
31    fi
32done
33