in reply to Re: find and replace from shell
in thread find and replace from shell
Note the following:#!/usr/bin/perl use strict; for my $file ( @ARGV ) { { local $/; open( my $fh, "<", $file ) or do { warn "unable to read $file\ +n"; next }; $_ = <$fh>; } s/( \{ \s* header\("Window-Target:\s*_top"\); \s* header\("Location:\s*index\.php"\); ) \s* \} /$1\n exit;\n}/gx; { open( my $fh, ">", $file ) or do { warn "unable to edit $file\ +n"; next }; print $fh $_; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: find and replace from shell
by johnkasta (Initiate) on Jun 17, 2010 at 16:33 UTC | |
by graff (Chancellor) on Jun 17, 2010 at 17:08 UTC | |
|
Re^3: find and replace from shell
by johnkasta (Initiate) on Jun 17, 2010 at 17:37 UTC |