in reply to Re^2: find and replace from shell
in thread find and replace from shell

  1. In my shell, (xterm) when I want to insert a newline I enter the two keys <CTRL>vj.
  2. To read the whole file you need to use the -0 switch with the value -0777 along with the -p switch.

Replies are listed 'Best First'.
Re^4: find and replace from shell
by johnkasta (Initiate) on Jun 17, 2010 at 15:03 UTC
    Thanks for your replies,

    when executing this in iterm..
    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

    I get back the following error messages
    Can't find string terminator "REGEX" anywhere before EOF at -e line 3.
    -bash: BEGIN: command not found
    -bash: s/@{[: No such file or directory
    I am probly missing something obvious, due to no EOF usage experience.
    Any help on these err messages is greatly appreciated!