in reply to Replacing text inside lots of files
You did not mention whether the new file name will be 10 characters.#!/usr/bin/perl -wT use strict; #my $filename is somehow parsed before this $filename =~ /^(\w+)\.\w+$/; my $replacewith = $1; open (FILE, "<$filename") || die ("Error: $!"); my $line = <FILE>; chomp $line; my $toreplace = substr($line,-10); close FILE; $line =~ s/$toreplace/$replacewith/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Replacing text inside lots of files
by Taulmarill (Deacon) on Oct 28, 2003 at 14:37 UTC | |
by bradcathey (Prior) on Oct 28, 2003 at 14:41 UTC |