#!/usr/bin/perl
#
# Author: Peter Keel <killer@discordia.ch>
# Changes some string in various textfiles into another. Does not accept
# a string on the commandline because I want to be able to use wildcards
# on the filenames.
#

$string1="ß";
$string2="ss";

die "Usage: $0 filenames\n"       unless($ARGV[0]);

foreach $file_name (@ARGV) {
    $temp_file="/tmp/$file_name";
    open(IN_FILE,"<$file_name") || die "Cannot open $file_name for input\n";
    open(TEMP,">$temp_file");
    while(<IN_FILE>){
	$_ =~ s/$string1/$string2/g;
        print TEMP ($_);
    }
    close IN;
    close TEMP;
    system ("mv $temp_file $file_name");
}
