[Cialug] find and replace strig in all files within a folder
afan at afan.net
afan at afan.net
Thu Jun 7 19:35:21 CDT 2012
hi,
what would be the easiest but most simplest way to find and replace string
"foo" with "bar" in all files within a folder (and all sub-folders)?
I found this
$find ./ -name "*.php" -exec sed -i "s/foo/bar/g" {} \;
and it works. But when I replace foo/bar with $_SESSION['status'] /
$_SESSION['value'] it doesn't work
when run
$find ./ -name "*.php" -exec sed -i
"s/$_SESSION['status']/$_SESSION['value']/g" {} \;
it replaced almost everycharacter with ['value'] :)
when tried
$find ./ -name "*.php" -exec sed -i
"s/\$_SESSION['status']/\$_SESSION['value']/g" {} \;
didn't do anything
suggestions?
thanks.
More information about the Cialug
mailing list