[Pdx-pm] filewise (not linewise) in-place editing?

Ken Brush ken at cgi101.com
Thu Oct 21 03:20:59 CDT 2004

On Wednesday 20 October 2004 16:22, Randall Hansen wrote:
> folks ~
> i've just needed to munge a group of files to change and concatenate
> data on several lines into one line.  usually i do something like:
> perl -pi -e 's/foo/bar/g' file1 ...
> this wouldn't work, since -p reads input files linewise.
> i wrote a little script to solve my problem, it resets $/ and sucks the
> whole file into a variable, munges it, and writes it.  is there a way
> to do this in a one-liner, similar to the above*?

You mean like this? 

perl -pi -e 's/zope/foo/g;s/\n/ /' perf.txt

or did you mean something more complex?


More information about the Pdx-pm-list mailing list