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

jwkrahn, thanks for your input!

1. please excuse the noobie question but when i copy and past this into my shell, iterm lays it out vertically and does not wait for my 'enter' to execute. how do i execute this in the shell?

2. perhaps it would be easier to change the -p to something else to tell it to read the whole file. what should I replace the -p with?
Thanks!

Replies are listed 'Best First'.
Re^3: find and replace from shell
by jwkrahn (Abbot) on Jun 16, 2010 at 21:13 UTC

    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.
      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!