Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Ive 30 个文件命名( db01.php 到 db30.php )
包括这一行
require_once('config.php');
我想添加或替换它
require_once('../new/config.php');
如何使用sed一次编辑这30个文件
sed -i 's/\(require_once(.\)\(config\.php.);\)/\1..\/new\/\2/' db*.php
sed -i "s/\(require_once('\)\(.*\.php\)\(');\)/\1..\/new\/\2\3/" db*.txt