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. Integer使用==比较的问题

    Integer使用==比较的问题 new一个对象 public Integer(int value) { this.value = value; } 自动装箱 public static Intege ...

  2. Linux环境安装Go

    1.下载Go发行版 从官方地址:https://golang.org/dl/ 上下载合适的 二进制发行版 (例如: go1.19.6.linux-amd64.tar.gz ): wget https: ...

  3. 添加material ui库

    ng add @angular/material 自定义预构建主题 ? Choose a prebuilt theme name, or "custom" for a custom ...

  4. 苹果手机第一次fixed没有达到预期效果,滚动下页面就正常了

    我们用ul li实现了一个视频列表,一共两列,点击其中一个播放时,会将该li设置为position: fixed;width:90%;也就是变成了一个弹窗的样式.安卓手机一切正常,然而当看到苹果,我- ...

  5. Vue 超长列表渲染性能优化

    参考:https://juejin.cn/post/6979865534166728711#heading-3 组件懒加载参考:https://github.com/xunleif2e/vue-laz ...

  6. pycharm软件基本使用python语法的注释变量的使用常量的使用变量的命名规范python的优化垃圾回收机制数据类型

    pycharm软件基本使用 1.pycharm基本的使用方法:1.点击file找到settings(设置)打开Appearance&Behavior点击Appearance看theme这个就是 ...

  7. DRF排序

    排序 对于列表数据,REST framework提供了OrderingFilter过滤器来帮助我们快速指明数据按照指定字段进行排序. 使用方法: 在类视图中设置filter_backends, 使用 ...

  8. Win10中找回曾复制过的东西

    按Win+V,如果弹出的"剪贴板历史"设置已经打开,那么就可以找回.建议大家打开这项设置以防万一.

  9. jinkens设置工作主目录

    linux下,默认jenkins的主目录,位于当前用户下的.jenkins目录,需要自定义该目录位置的时候,可以通过设定环境变量 JENKINS_HOME 然后重启jenkins nohup java ...

  10. iview、render使用方法

    1.<Table size="large" :columns="columns7" :data="labelInput.label" ...