#!/usr/bin/perl -w -i~ 

# Wee script to replace strings (or other regexps with a string of your
# choice.  Inspired by the sh script of the same name, which kept mangling
# my chmod u+x, and occasionally deleted my files (if I gave it a bad
# input).  
#                        Written by David Roundy in March 2000.

if ($#ARGV < 2) {
    print $#ARGV;
    die "Usage:  $0 <oldstr> <newstr> [files]\n";
}

$old = shift(@ARGV);
$new = shift(@ARGV);
while (<>) {
    if (/$old/) {
        print STDERR "* $_";
        s/$old/$new/;
        print STDERR "> $_";
    }
    print $_;
}




