I have the following code to replace text in one file. How do I modify this code to replace text in multiple files with same extension.
*********************************#!/usr/bin/perl $file = "new.txt"; open (IN,$file) || die "could not open ".Sfile." for read"; @lines=<IN>; close IN; open (OUT,">", $file) || die "can not open file ".$file." for write"; foreach $line (@lines) { $line =~ s/Hello/goodby/ig; print OUT $line; } close OUT;
In reply to Replace strings in multiple files by najiz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |