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. mssql 常用sql 语句

    ----insert ----delete----update----select ----选择数据库进行操作select top 1 * from smzx2018.dbo.tbuseruse sm ...

  2. oracle快速将表缓存到内存

    共有2种方法: 1) alter table fisher cache; 2) alter table fisher storage(buffer_pool keep); --取消缓存 1) alte ...

  3. Ubuntu中用普通方法无法添加自启动

    参考了https://www.cnblogs.com/a5idc/p/13752839.html 如何知道你使用的是哪个init系统?你可以使用这个命令来知道与PID 1(系统上运行的第一个进程)相关 ...

  4. pycharm取消代码长度的竖线

  5. 【9】java之static关键字

    一. static 定义属性 static 定义的属性和非 static 定义的属性有一个最大区别:所有的非 static 属性必须产生实例化对象之后才可以访问,static 定义的属性不受此限制.也 ...

  6. vue中引入字体

    前言: 做大屏 项目需要引入字体做个记录一.先看看效果  二.实现1.下载字体文件 分享一个下载开源字体网站: https://www.dafont.com/theme.php2.文件放到项目中 可以 ...

  7. 第八周作业-N67044-张铭扬

    1. 完成ftp的mysql虚拟用户 数据库服务器:10.0.0.152 FTP服务器:10.0.0.156 #配置数据库服务器 [root@centos8 ~]# yum -y install ma ...

  8. 前端JavaScript深拷贝的三种方法,看了不后悔!!!

    深拷⻉ 深拷⻉开辟⼀个新的栈,两个对象属完成相同,但是对应两个不同的地址,修改⼀个对象的属性,不会 改变另⼀个对象的属性 常⻅的深拷⻉⽅式有: _.cloneDeep() jQuery.extend( ...

  9. SQL SERVER提示pre-login handshake failed错误的一种解决方法。

    昨天在客户那里,遇到一个奇怪的问题.程序直接运行的时候,可以正常连接SQL SERVER; 但是使用Web Service连接SQL SERVER的时候,出现了下面的错误信息: Connection ...

  10. oracle 导出导入表 不到出指定表

    导出多个表 exp LSXYYSZHMRMS/******@PK99SERVICE file=d:\fuhcx.dmp  tables=(fhcxgxxx,fhcxjcxx,fhcxlbxx,fhcx ...