#!/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(后)\增加的内容" 要修改的文件名称

  

apache中 sed 指定文件中某字符串增加行的更多相关文章

  1. 自定义VBS脚本(统计在指定文件中搜索字符串出现的次数)

    '=========================================================================='' VBScript Source File - ...

  2. 通过wget工具下载指定文件中的URLs对应的资源并保存到指定的本地目录中去并进行文件完整性与可靠性校验

    创建URLs文件在终端输入cd target_directory回车,便把当前文件夹切换到了目标文件夹target_directory,此后创建的文件都会丢它里面在终端输入cat > URLs回 ...

  3. flink---实时项目--day01--1. openrestry的安装 2. 使用nginx+lua将日志数据写入指定文件中 3. 使用flume将本地磁盘中的日志数据采集到的kafka中去

    1. openrestry的安装 OpenResty = Nginx + Lua,是⼀一个增强的Nginx,可以编写lua脚本实现⾮非常灵活的逻辑 (1)安装开发库依赖 yum install -y ...

  4. java:从指定问价中读取80个字节写入指定文件中

    import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; public class F ...

  5. 解压tar包中的指定文件

    解压<a 'tar');"="" href="http://asmboy001.blog.51cto.com/'#\'"" targe ...

  6. 在eclipse中查找指定文件 [多种方法]

    在eclipse中查找指定文件   1.ctrl+h打开搜索界面 File Search: containing text填*,File name patterns填写hello.*,可以找到hell ...

  7. WPF获取读取电脑指定文件夹中的指定文件的地址

    //保存指定文件夹中的指定文件的地址 string List<string> mListUri = new List<string>(); //文件夹地址 string fol ...

  8. python实现在目录中查找指定文件的方法

    python实现在目录中查找指定文件的方法 本文实例讲述了python实现在目录中查找指定文件的方法.分享给大家供大家参考.具体实现方法如下: 1. 模糊查找 代码如下: import os from ...

  9. python 将指定文件夹中的指定文件放入指定文件夹中

    import os import shutil import re #获取指定文件中文件名 def get_filename(filetype): name =[] final_name_list = ...

随机推荐

  1. pc端移动端拖拽实现

    #div1 { width: 100px; height: 100px; background: red; position: absolute; } html <div id="di ...

  2. 【jq】prop和attr的区别

    prop()函数的结果: 1.如果有相应的属性,返回指定属性值. 2.如果没有相应的属性,返回值是空字符串. attr()函数的结果: 1.如果有相应的属性,返回指定属性值. 2.如果没有相应的属性, ...

  3. 监控glusterfs

    监控集群状态 [4ajr@elk1 scripts]$ cat glusterfs_peer_status.sh #!/bin/bash peer_status=`sudo gluster peer ...

  4. python 获取秒级时间间隔

    import datetime,time start_tm=datetime.datetime.now() time.sleep() end_tm=datetime.datetime.now() pr ...

  5. springboot为导出的pdf和excel加水印

    相信很多小伙伴们在做导出pdf或者excel文件时会被要求在文件上加上水印,本篇博客就来讲讲如何为pdf和excel加水印. 导出pdf加水印 其实在导出pdf时加上水印并不难,因为itext提供了添 ...

  6. JSP 学习总结 03 核心组件 Servlet

    1 Servlet 简绍 Servlet(Server Applet)是Java Servlet的简称,称为小服务程序或服务连接器,用Java编写的服务器端程序,主要功能在于交互式地浏览和修改数据,生 ...

  7. js字符串转时间

    function StrToDateTime(value) { if (value) { return (new Date(Date.parse(value.replace(/-/g, "/ ...

  8. 【原创】分布式之大话CAP

    引言 本文翻译自博客 http://ksat.me/a-plain-english-introduction-to-cap-theorem/ 博主觉得这个故事讲的生动活泼,因此翻译来给大家分享,顺便加 ...

  9. C Programming Style 总结

    对材料C Programming Style for Engineering Computation的总结. 原文如下: C Programming Style for Engineering Com ...

  10. 简单的JQuery完美拖拽

    首先导入jq库,最好是1.0版本的.调用函数时,传入要拖拽元素的id值. function drag(sel){ $div = $("#"+sel); $div.mousedown ...