https://www.cnblogs.com/lixinliang/p/10245460.html
1
2
3
4
5
6
7
8
9
10
|
#!/bin/bash
#在 servername 域名 字符串后面添加指定字符串
servername=`grep ServerName httpd-vhosts.conf |awk '{print $2}'`
for conf in $servername;do
sed -i "/ServerName $conf/a\ErrorLog "logs/${conf}_error.log"" httpd-vhosts.conf
sed -i "/ServerName $conf/a\CustomLog "logs/${conf}_access.log" common" httpd-vhosts.conf
done
注: sed -i "/指定字符串/a(后)\增加的内容" 要修改的文件名称
|
显示SyncTaskController.php文件中每个函数的函数名
[root@web_test]# sed -i "/function/a\echo __method__;" SyncTaskController.php