ths-scripts/applysed

43 lignes
1.3 KiB
Bash
Fichiers exécutables

#!/bin/bash
#
# Copyright 2007, Donatas Glodenis <dgvirtual@akl.lt>
# Copyright 2009, Andrius Štikonas <andrius@stikonas.eu>
#
# #
# # This script is free software; you can redistribute it and/or modify
# # it under the terms of the GNU General Public License 2 as published by
# # the Free Software Foundation.
#
# # This script is distributed in the hope that it will be useful,
# # but WITHOUT ANY WARRANTY; without even the implied warranty of
# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# # GNU General Public License for more details.
# #
# # You should have received a copy of the GNU General Public License
# # along with this script; if not, write to the Free Software
# # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# ths-applysed.sh - apply a sed script to the whole project (the sed commands
# have to be supplied in an external file).
source "`dirname $0`/ths-variables"
function usage() {
echo "Usage: `basename $0` <file-with-replacement-list> <base-directory>"
echo
echo "Example of the replacements file content:"
echo "s/bylai/failui/g"
echo "s/bylą/failą/g"
echo "s/byloje/faile/g"
exit 1
}
if [ $# -ne 2 ]; then
usage
fi
for po in `find -L $2 -name "*.po"`; do
echo -e $BLUE"$po"$ENDCOLOR
sed --file=$1 -i $po
done