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. Vulhub 漏洞学习之:Redis

    Vulhub 漏洞学习之:Redis 1 Redis简介 Redis 是完全开源的,遵守 BSD 协议,是一个高性能的 key-value 数据库.Redis 与其他 key - value 缓存产品 ...

  2. 一个更适合Java初学者的轻量级开发工具:BlueJ

    Java是世界上最流行的编程语言之一,它被广泛用于从Web开发到移动应用的各种应用程序.大部分Java工程师主要是用IDEA.Eclipse为主,这两个开发工具由于有强大的能力,所以复杂度上就更高一些 ...

  3. drag拖拽相关

    实际开发中会遇到一些和拖拽有关的问题 : 1.移动端不支持鼠标拖拽功能, 2.拖拽时会选中页面中的其他文字,解决办法: <div onSelectStart="return false ...

  4. php链接access并查询列出

    <?php$odbc = "Driver={Microsoft Access Driver (*.mdb)};Dbq=".realpath("db.mdb" ...

  5. rotate matrix

  6. python sys.argv(全局文本索引替换)

    #利用sys.argv(实现从程序外部向程序传递参数.)写一个脚本.#全局替换(old_str to new_str,filename)import sys #导入sys模块print(sys.arg ...

  7. lg8365题解

    容易发现我们一定会先加后乘,使用调整法可以证明这个结论. 并且可以发现除了\(a_i\)值为\(1\)的数外(假设他们的\(a\)值和为\(s\)),其他的数最多只会选\(1\)个做加法操作(设如果其 ...

  8. 464. 我能赢吗 (Medium)

    问题描述 464. 我能赢吗 (Medium) 在 "100 game" 这个游戏中,两名玩家轮流选择从 1 到 10 的任意整数,累计整数和,先使得累计整数和 达到或超过 100 ...

  9. Java面向对象之封装详解

    封装详解 封装 该露的露,该藏的藏 1.我们程序设计要追求"高内聚.低耦合".高内聚:类的内部数据操作细节自己完成,不允许外部干涉:低耦合:仅暴露少量的方法给外部使用. 封装(数据 ...

  10. 【Excel】IF条件函数公式怎么用?

    版本 Excel 2019 步骤 点击插入函数 打开文档,点击公式菜单下的插入函数. 双击选择IF函数 在函数列表双击选择IF函数. 输入条件测试值 在第一个输入框输入条件测试值. 设置输出结果值