search and replace
The first line of the file a1.txt will search for the
same "word combination" in 76 files (herein/1.txt till 76.txt, you can
change the number). It will then replace the entry with the first line
of b1.txt (every time it finds it). With a few modifications you can
replace hundreds of words. It will save the result in the directory
heraus.
open (ERSTE, "a1.txt") || die "Datei1 nicht gefunden\n";
@fileinput1 = <ERSTE>;
close (ERSTE);
$aa1 = @fileinput1[0];
chop $aa1;
$ca1 = $aa1;
open (ERSTE, "b1.txt") || die "Datei2 nicht gefunden\n";
@fileinput2 = <ERSTE>;
close (ERSTE);
$ab1 = @fileinput2[0];
chop $ab1;
$cb1 = $ab1;
$i = 1;
while($i <= 76)
# number of files in directory
{
open (DRITTE, "herein/$i.txt") || die "Datei3 nicht gefunden\n";
@inhalte = <DRITTE>;
close (DRITTE);
$satz = @inhalte[0];
$satz =~ s/$ca1/$cb1/g;
open (FERTIG, ">heraus/$i.txt");
print FERTIG "$satz";
close (FERTIG);
$i++;
}
Back
to previous page
|
Get Free
Autoresponder
Enter your email address below
and you will receive a powerful
Autoresponder and
our Special Ezine for free:
(Please use your real email
address or else you won't receive the free script)
Or you can subscribe by clicking
this link to send an email automatically:
mailto:amlmEzine@DrQuek.com
|