gsub

atd/src/bin/gsub · 475 B

From the archive AtDv2.0.tar.gz

Download the archive   « Back to the archive contents

# !/bin/sh
# I poached this idea from the mud++ distribution 'cause it's so damned useful
# --Symposium
#
# Do global replacement of string in all source code files.
# I use this all the time, but I advise you to be careful
# make sure you make as complete a regular expression as possible
# ensure you quote properly as well.

if [ $# -lt 2 ]; then
    echo Usage: $0 \'src\' \'dest\'
    exit 1
fi

# echo Replacing \'$1\' with \'$2\'
exec perl -pi~ -e "s/$1/$2/g" *.c *.h

Site Stats

Snippets: 1791
Codebases: 571