#!/bin/bash # # Copyright 2007, Donatas Glodenis # # # # # 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). ## example of the replacements file content (remove preceeding comment marks #): # ================== # s/bylai/failui/g # s/bylą/failą/g # s/byloje/faile/g # ================== function usage() { echo "Usage: `basename $0` " echo "WARNING: " echo "SPECIFY FULL PATHS, OTHERWISE ALL YOUR FILES WILL BE DELETED!" echo "DO A BACKUP BEFORE USING THIS SCRIPT!" echo echo "Example of the replacements file content" echo "======== file begins ========" echo "s/bylai/failui/g" echo "s/bylą/failą/g" echo "s/byloje/faile/g" echo "======== file ends ==========" exit 1 } if [ $# -ne 2 ]; then usage fi replacefile=$1 directory=$2 cd $directory for po in `find . -name "*.po" | sort` do echo "Working on $po ..." sed --file=$replacefile -i $po echo "...done." done