Tim Johnson wrote:
>
> Here's the textbook way to do it (TIMTOWTDI of course, but
> nevertheless):
I guess it depends on your textbook. :-)
> ##
>
> use strict;
> use warnings;
> open(INFILE," reading!\n";
> open(OUTFILE,">BUS_SCHEDULE.new") || die "Couldn't ope
Here's the textbook way to do it (TIMTOWTDI of course, but
nevertheless):
##
use strict;
use warnings;
open(INFILE,"BUS_SCHEDULE.new") || die "Couldn't open BUS_SCHEDULE.new
for writing!\n";
while(){
$_ =~ s/bus/magic_bus/gi; #g for every occurrence, i for
> Hi There,
Howdy
>
> How do I read a file and replace all occurences of a word in it with
> another word. For example, I want to read the file BUS_SCHEDULE and
> map bus to magic_bus.
>
perl -pi -e 's/\bbus\b/magic_bus/g;' BUS_SCHEDULE
The pie tells perl tp read the files that you
have
Hi There,
How do I read a file and replace all occurences of a word in it with
another word. For example, I want to read the file BUS_SCHEDULE and
map bus to magic_bus.
- Jason
/•
• If A equals success, then the formula is:
• X+Y+Z = A
• X is work. Y is play. An