Sed在匹配行前后加入一行
- font size decrease font size increase font size
- Print Email
a 追加内容 sed ‘/匹配词/a\要加入的内容’ example.file(将内容追加到匹配的目标行的下一行位置)
i 插入内容 sed ‘/匹配词/i\要加入的内容’ example.file 将内容插入到匹配的行目标的上一行位置)
示例:
#我要把文件的包含“chengyongxu.com”这个关键词的行前或行后加入一行,内容为“allow chengyongxu.cn”
1 | #行前加 |
2 | sed -i '/allow chengyongxu.com/i\allow chengyongxu.cn' the.conf. file |
3 | #行前后 |
4 | sed -i '/allow chengyongxu.com/a\allow chengyongxu.cn' the.conf. file |
( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0012 | 412840 | {main}( ) | .../index.php:0 |
2 | 0.0743 | 4263048 | Joomla\CMS\Application\SiteApplication->execute( ) | .../index.php:49 |
3 | 0.0743 | 4263048 | Joomla\CMS\Application\SiteApplication->doExecute( ) | .../CMSApplication.php:196 |
4 | 0.2732 | 11454064 | Joomla\CMS\Application\SiteApplication->dispatch( ) | .../SiteApplication.php:233 |
5 | 0.2738 | 11478568 | Joomla\CMS\Component\ComponentHelper::renderComponent( ) | .../SiteApplication.php:194 |
6 | 0.2745 | 11533896 | Joomla\CMS\Component\ComponentHelper::executeComponent( ) | .../ComponentHelper.php:377 |
7 | 0.2748 | 11561296 | require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ) | .../ComponentHelper.php:402 |
8 | 0.2821 | 11960928 | K2ControllerItem->execute( ) | .../k2.php:64 |
9 | 0.2821 | 11960928 | K2ControllerItem->display( ) | .../BaseController.php:710 |
10 | 0.2910 | 12611632 | K2ControllerItem->display( ) | .../item.php:78 |
11 | 0.2910 | 12611632 | K2ControllerItem->display( ) | .../controller.php:19 |
12 | 0.2950 | 12982672 | Joomla\CMS\Cache\Controller\ViewController->get( ) | .../BaseController.php:663 |
13 | 0.2983 | 13003040 | K2ViewItem->display( ) | .../ViewController.php:102 |
14 | 0.3685 | 15812112 | K2ViewItem->display( ) | .../view.html.php:742 |
15 | 0.3685 | 15812112 | K2ViewItem->loadTemplate( ) | .../HtmlView.php:230 |
16 | 0.3711 | 15985048 | include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ) | .../HtmlView.php:701 |
- Published in CentOS 6
- Read 2577 times
( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0012 | 412840 | {main}( ) | .../index.php:0 |
2 | 0.0743 | 4263048 | Joomla\CMS\Application\SiteApplication->execute( ) | .../index.php:49 |
3 | 0.0743 | 4263048 | Joomla\CMS\Application\SiteApplication->doExecute( ) | .../CMSApplication.php:196 |
4 | 0.2732 | 11454064 | Joomla\CMS\Application\SiteApplication->dispatch( ) | .../SiteApplication.php:233 |
5 | 0.2738 | 11478568 | Joomla\CMS\Component\ComponentHelper::renderComponent( ) | .../SiteApplication.php:194 |
6 | 0.2745 | 11533896 | Joomla\CMS\Component\ComponentHelper::executeComponent( ) | .../ComponentHelper.php:377 |
7 | 0.2748 | 11561296 | require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ) | .../ComponentHelper.php:402 |
8 | 0.2821 | 11960928 | K2ControllerItem->execute( ) | .../k2.php:64 |
9 | 0.2821 | 11960928 | K2ControllerItem->display( ) | .../BaseController.php:710 |
10 | 0.2910 | 12611632 | K2ControllerItem->display( ) | .../item.php:78 |
11 | 0.2910 | 12611632 | K2ControllerItem->display( ) | .../controller.php:19 |
12 | 0.2950 | 12982672 | Joomla\CMS\Cache\Controller\ViewController->get( ) | .../BaseController.php:663 |
13 | 0.2983 | 13003040 | K2ViewItem->display( ) | .../ViewController.php:102 |
14 | 0.3685 | 15812112 | K2ViewItem->display( ) | .../view.html.php:742 |
15 | 0.3685 | 15812112 | K2ViewItem->loadTemplate( ) | .../HtmlView.php:230 |
16 | 0.3711 | 15985048 | include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ) | .../HtmlView.php:701 |