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. video遇到问题汇总

    1.调取视频自动播放video.play()时报错 Uncaught (in promise) DOMException: play() failed because the user didn't ...

  2. Postgresql架构体系解析

    一.PostgreSQL物理架构 postgresql的物理架构非常简单,它由共享内存.一系列后台进程和数据文件组成. 二.Shared Memory 共享内存是服务器服务器为数据库缓存和事务日志缓存 ...

  3. DataGridView添加新一行数据可添加到最后一行或第一行

    整体代码如下: using System;using System.Collections.Generic;using System.ComponentModel;using System.Data; ...

  4. C++ MFC学习 (四)

    对话框 创建MFC应用程序时,选择对话框 可使用向导创建对应的对话框的类 1 // MFC_Demo2Dlg.cpp : 实现文件 2 // 3 4 #include "stdafx.h&q ...

  5. linux 端口的相关命令

    查看某个端口是否开发 isof -i:端口 说明:如果有显示说明已经开放了,如果没有显示说明没有开放 开放端口之后,查看防火墙是否对端口开放 查询端口号80 是否开启: firewall-cmd -- ...

  6. C语言中的malloc、new、memset函数解析

    1. malloc 在window下,malloc的函数原型: extern void *malloc(unsigned int num_bytes); 头文件: #include<malloc ...

  7. k3s|如何将k8s集群的node节点设置不可调度或删除node节点?

    k3s|如何将k8s集群的node节点设置不可调度或删除node节点? k3s是由 Rancher 公司开发的轻量级Kubernetes,是经CNCF一致性认证的Kubernetes发行版,专为物联网 ...

  8. Vue项目使用/deep/报错:SassError: expected selector解决方案--亲测有效

    项目npm run dev报错如下: 解决方法: 尝试用 ::v-deep 替换 /deep/ ,成功解决了问题. 效果如下图所示(完美解决~) 某些预处理器(例如Sass)可能无法>>& ...

  9. Software_programming_EnterpriseArch_ServiceWithSingleTonFactory

    19:50:31 <UML 模式和应用> P322 系统需要支持多种第三方外部服务,例如费用计算,授权服务,库存系统,都具有不同的API, 而且还无法改变. 解决方案之一: 使用 单例模式 ...

  10. Vue.js中使用iView日期选择器并设置开始时间结束时间校验

    废话不多说直接上代码,拷贝代码保存为 html 文件,用浏览器打开就可以看到效果. 在线查看效果:https://run.iviewui.com/PmGsUW3P 1 <!DOCTYPE htm ...