so, top posting, ikr :)

use bash :)

do something like 
#!/bin/bash
LST=`find ./ -name '*.php'`
for FILENAME in "$LST"; do
        sed -i -e "s/$FROM/$TO/g" $FILENAME
done

hth

ac


On Thu, 18 Feb 2016 15:05:53 -0600 (CST)
"Jeremy C. Reed" <r...@reedmedia.net> wrote:

> On Thu, 18 Feb 2016, Jeremy C. Reed wrote:
> 
> > I am looking for a command-line tool to do multi-line replacements.
> > Something like:
> > 
> > the-tool --search file-containing-lines-to-match \
> >   --replace file-containing-new-lines < original-file > new-file
> > 
> > Does anyone know of a tool like this?
> > 
> > I can do it with sed like:
> > 
> > sed -e :a -e '$!N;s/^string1\nstring2$/string3\
> > string4/;ta' -e 'P;D'
> 
> Actually that won't work for more than one \n in the lhs.
> 
> $ cat ~/J 
> AA
> BB
> CC
> DD
> EE
> 
> $ sed -e :a -e '$!N;s/BB\nCC\nDD/11\^J22/;ta' -e 'P;D' < ~/J 
> AA
> BB
> CC
> DD
> EE
> 
> $ sed -e :a -e '$!N;s/BB\nCC/11\^J22/;ta' -e 'P;D' <
> ~/J AA
> 11
> 22
> DD
> EE

Reply via email to