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. 初始化安装后 Nacos 动态路由配置不生效

    一.问题描述 1.每次初始化安装整套项目,包括安装 Nacos 和其他服务还有mysql,redis等其他中间件,安装后 Nacos 获取不到 nacos 路由信息(包括后续新写入动态路由配置)!只有 ...

  2. Dev Express 框架自定义登录添加短信验证功能

    需求:登录界面改成这样 记录一下过程,以便下次操作类似的步骤有遗忘,也与大伙儿分享下,如有不当之处请指出,感谢. 参考官网文档:https://docs.devexpress.com/eXpressA ...

  3. Android 缩小动画

    public class MainActivity extends AppCompatActivity { private ConstraintLayout content; @Override pr ...

  4. PKU2506Tiling

    https://blog.csdn.net/Harington/article/details/86612106

  5. Day 22 22.3:生产者和消费者模式

    生产者消费者模式 认识生产者和消费者模式 生产者和消费者是异步爬虫中很常见的一个问题.产生数据的模块,我们称之为生产者,而处理数据的模块,就称为消费者. 例如: ​ 图片数据爬取中,解析出图片链接的操 ...

  6. [WinError 10061] 由于目标计算机积极拒绝,无法连接。- EnlightenGan运行

    在测试EnlightenGan时,可视化结果保存出现问题. 原因:调用visdom可视化,需要先打开visdom python -m visdom.server

  7. 动态class 及 动态style

    动态改变某一范围内的字体颜色 低于90   大于90小于95    大于95 两种方法都可以 <div class="dhd-num4" :style="{'col ...

  8. 阿里播放器Aliplayer遇到的所有坑

    1,关于阿里播放器使用过的几种播放方式 url (source) ① 要在创建播放器前要拿到资源否则会报错 ② 在有不同清晰度的资源时  直接调用 player.loadByUrl() 方法会报错 官 ...

  9. 挂上burpsuite代理之后显示505 HTTP Version Not Supported 解决方法

    505 HTTP Version Not Supported  什么意思呢? HTTP505状态码代表的意思是 服务器不支持的HTTP版本,即 HTTP 505 HTTP Version Not Su ...

  10. Redis设置开机自启动

    0.前提条件 redis_version:7.0.5 Linux Alibaba Cloud Linux release 3 (soaring Falcon) 查询版本有如下两种方式: 1.通过red ...