in reply to find and replace from shell
Using the -p switch means that you are only reading one line at a time. You need to either read in the whole file or change the Input Record Separator to something like "}\n".
This may work, but it is UNTESTED:
perl -i -pe' BEGIN { $/ = "}\n" } s/@{[ <<REGEX ]}/@{[ <<STRING ]}/g; if ((!(\$session_login)) or (\$session_access < 5)) { header("Window-Target: _top"); header("Location: index.php"); } REGEX if ((!(\$session_login)) or (\$session_access < 5)) { header("Window-Target: _top"); header("Location: index.php"); exit; } STRING ' *.php
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: find and replace from shell
by johnkasta (Initiate) on Jun 16, 2010 at 19:58 UTC | |
by jwkrahn (Abbot) on Jun 16, 2010 at 21:13 UTC | |
by johnkasta (Initiate) on Jun 17, 2010 at 15:03 UTC | |
|
Re^2: find and replace from shell
by johnkasta (Initiate) on Jun 16, 2010 at 20:41 UTC | |
by AnomalousMonk (Archbishop) on Jun 16, 2010 at 23:30 UTC |