sed -i "/test2/s/^/#/" test.log

https://jaminzhang.github.io/linux/sed-command-usage-summary/

comment out one line in the file with sed的更多相关文章

  1. RHEL5.X 重启网卡出现./network-functions: line 78: .: ifcfg-eth0: file not found

    错误信息: 红帽RHEL5.5系统,重启网卡报错 [root@localhost network-scripts]# service network restart Shutting down int ...

  2. MySQL_ERROR 1231 (42000) at line XX in file 'file_name' Variable 'time_zone' can't be

    类似的错误信息如下 ERROR 1231 (42000) at line 10370 in file: '/root/sql/ultrax_170322.dmp': Variable 'time_zo ...

  3. 刷题中熟悉Shell命令之Tenth Line和Transpose File [leetcode]

    首先介绍题目中要用的4个Shell命令 sed awk head tail的常用方法.(打好地基,才能建成高楼!) sed:(转自:http://www.cnblogs.com/barrychiao/ ...

  4. git报错:fatal: bad config line 1 in file C:/Users/JIANGXIAOLIANG/.gitconfig

    在给git设置用户名和邮箱的时候报下面的错误:fatal: bad config line 1 in file C:/Users/JIANGXIAOLIANG/.gitconfig看提示的意思是git ...

  5. 常规问题解决:File "/usr/bin/yum", line 30 及 File "/usr/libexec/urlgrabber-ext-down", line 28

    在执行yum命令时忽然发现出现以下报错: # yum list File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ...

  6. while read line do done < file

    zzx@zzx120:~/test1$ cat file.txt    1122zzx@zzx120:~/test1$ cat ./read.sh #!/bin/bashwhile read line ...

  7. Go to the first line OR the last line of the file

    (1) 跳到首行 :1 或 gg (2)跳到最后一行 :$ 或 G 或shift+g(大写.当前若大小写锁定直接按g,未锁定则按shift+g)

  8. idea git pull fatal: bad config line 1 in file /.gitconfig 问题处理

    在网上搜好多都是直接改username和useremail的,但是没有说明原理. 因为我的电脑是新入职接手上一家的电脑 后来在git bash 里面用$ git config user.name 原来 ...

  9. how to read the 10th line of a text using shell script

    how to read the 10th line of a text using shell script shell script / bash script question https://l ...

  10. Linux sed Examples--转载

    原文地址:https://www.systemcodegeeks.com/shell-scripting/bash/linux-sed-examples/?ref=dzone Sed is basic ...

随机推荐

  1. 早期SpA患者髋关节的受累发生率

    早期SpA患者髋关节的受累发生率 EULAR2015, PresentID: FRI0236 原文 译文 How often are hip joints involved in patients w ...

  2. 时钟切换电路(无毛刺)——clock switching glitch free

    0.引言 随着越来越多的多频时钟被应用在今天的芯片中,尤其是在通信领域中,经常需要在芯片运行时切换时钟线的源时钟.这通常是通过在硬件中复用两个不同的频率时钟源,并通过内部逻辑控制多路选择器选择线来实现 ...

  3. mysql 数据库的一些参数,常用模版和调优方式

    innodb_buffer_pool_size :这个参数是Mysql数据库最重要的参数之一,表示InnoDB类型的 表 和索引的最大缓存 .它不仅仅缓存 索引数据 ,还会缓存 表的数据 .这个值越大 ...

  4. Vue ref属性

    ref属性 1.被用来给元素或子组件注册引用信息(id的替代者) 2.应用在html标签上获取的是真实DOM元素: 应用在组件标签上是组件实例对象 vc 3.使用方法: (1)打标识:<h1 r ...

  5. [C#]为debug添加DebuggerDisplay属性

    最近才发现,DebuggerDisplay 非常弓虽大,给类添加DebuggerDisplay属性后可以让调试变得更简单.如何使用? 1.定义一个有DebuggerDisplay的类:在类的头部添加& ...

  6. 野火FreeRTOS计数信号量实验意外处理

    编译的时候,一直说xSemaphoreCreateCounting这个函数没有定义. 最后发现,是FreeRTOSConfig.h文件中,没有将使能计数信号量的宏打开. 解决办法:在FreeRTOSC ...

  7. Python3中Super函数的使用

    Super函数用法 主要用于调用父类函数 代码演示 class A: def __init__(self): self.n = 2 print('此时执行A的自定义函数,self的n值为',self. ...

  8. pip 源修改,换国内

    pip国内的一些镜像   阿里云 https://mirrors.aliyun.com/pypi/simple/  中国科技大学 https://pypi.mirrors.ustc.edu.cn/si ...

  9. gitlab-runner运行流水线过程中出现报错

    1.提示error: could not lock config file D:\gitlab-runner\builds\fJW28yU8\0\auto_test_10\auto_test_dp20 ...

  10. maven导入本地依赖

    本地依赖mvn install:install-file -DgroupId=tsf-core-1.0.0 -DartifactId=tsf-core-1.0.0 -Dversion=0.0.1-SN ...