我正在尝试将以下所有文件中的所有实例替换$timestamp = mysqli_real_escape_string($db_conx, $_POST['Timestamp']);
为$timestamp = date("Y-m-d H:i:s");
/home/user/public_html/
我已经尝试了以下命令的许多变体,但似乎无法正确转义!
find /home/user/public_html/ -type f -print0 | xargs -0 sed -i 's/\$timestamp = mysqli_real_escape_string(\$db_conx, \$_POST['\''Timestamp'\'']);/\$timestamp = date(\"Y-m-d H:i:s\");/g'
答案1
感谢@phk,我得到了它
find /home1/user/public_html/ -type f -print0 | xargs -0 sed -i 's/\$timestamp = mysqli_real_escape_string(\$db_conx, \$_POST\['\''Timestamp'\''\]);/\$timestamp = date("Y-m-d H:i:s");/g'