#!/usr/bin/perl -w
use File::Find;
my ($path,$login,$user) = @ARGV;
if (not $user) {$user =(getpwnam($login))[6]};
if (not $path) {die "Pfad nicht g&uuml;ltig";}
File::Find::find(\&change_files,$path);
sub change_files {
	my $file = $_;
	return unless -f $_;
	open(FILE, "<$file") or return;
	my $data = join('', <FILE>);
	close(FILE);
	my $orig = $data;
	$data =~ s/\%user\%/$user/g;
	$data =~ s/\%login\%/$login/g;
	if ($data ne $orig) {
		open FILE, ">$file" or return;
		print FILE $data;
		close FILE;
	}
}
