1

我有这样的文件,我想$GLOBALS['SERVER_MEMCACHED']='localhost';$GLOBALS['SERVER_MEMCACHED']='mydomain.com';sed 替换。

这该怎么做 ?我也不想更换 DB_HOST。

<?php
$GLOBALS['DB_HOST']='localhost';
$GLOBALS['DB_NAME']='database';
$GLOBALS['DB_LOGIN']='login';
$GLOBALS['DB_PASSWORD']='password';
$GLOBALS['PORT_MYSQL']='3306';
$GLOBALS['PORT_MYSQLI']='3306';
$GLOBALS['SERVER_MEMCACHED']='localhost';
$GLOBALS['PORT_MEMCACHED']='11211';
$GLOBALS['CACHE_TIME']=600;
?>
4

1 回答 1

2
sed -i '/SERVER_MEMCACHED/s/localhost/mydomain.com/' input
于 2012-06-24T22:14:11.647 回答