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
In reply to Re: find and replace from shell
by jwkrahn
in thread find and replace from shell
by johnkasta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |