[root@localhost cee]# echo this thisthisthis |sed 's/this/THIS/g'
THIS THISTHISTHIS
[root@localhost cee]# echo this thisthisthis |sed 's/this/THIS/2g'
this THISTHISTHIS
[root@localhost cee]# echo this thisthisthis |sed 's/this/THIS/3g'
this thisTHISTHIS
[root@localhost cee]# echo this thisthisthis |sed 's/this/THIS/4g'
this thisthisTHIS

[root@localhost cee]# cat temp
i love linux

i love python
william
[root@localhost cee]# sed '/^$/d' temp
i love linux
i love python
william
[root@localhost cee]# cat temp
i love linux

i love python
william

[root@localhost cee]# echo this is an example |sed 's/\w\+/[&]/g'
[this] [is] [an] [example]
[root@localhost cee]# echo this is an example |sed 's/\w\+/"&"/g'
"this" "is" "an" "example"
[root@localhost cee]# echo this is digit 7 in a number | sed 's/digit \([0-9]\)/\1/g'
this is 7 in a number

[root@localhost cee]# echo seven EIGHT |sed 's/\([a-z]\+\) \([A-Z]\+\)/\2 \1/g'
EIGHT seven

sed 'exp'|sed 'exp2' == sed 'exp;exp2'

[root@localhost cee]# text=hello
[root@localhost cee]# echo hello world | sed "s/$text/HELLO/g"
HELLO world

50个常用的Linux命令(二)sed的更多相关文章

  1. 50个常用的Linux命令(三)基础实例

    ls ls -als -l == llls -Aldrwxrwxrwx.  2 root   root       6 Dec 21 20:38 Videos-rwxrwxrwx   1 root   ...

  2. 50个常用的Linux命令(三)awk

    [root@localhost cee]# echo -e "line1\nline2"|awk '{ print }'line1line2[root@localhost cee] ...

  3. 50个常用的Linux命令

    1.tar tar -xvf archive_name.tar  解压文件 tar -cvf archive_name.tar file 把文件file压缩成archive_name.tar tar ...

  4. 开发过程中常用的Linux命令

    做Java开发好几年了,部署JavaWeb到服务器上,一般都选择Linux,Linux作为服务器真是不二之选,高性能,只要熟悉Linux,操作快捷,效率很高. 总结一下工作中常用的Linux命令备忘: ...

  5. 初学者常用的LINUX命令

    测试初学者常用的LINUX命令 一.常用管理命令:1. shutdown -h now 关机命令2. shutdown -r now (reboot) 立即重启命令 3. clear 清屏命令 4. ...

  6. 每天一个linux命令(61):vi命令 /企业常用的linux命令清单

    vi/vim 的使用 基本上 vi/vim 共分为三种模式,分别是一般模式.编辑模式与指令列命令模式. 这三种模式的作用分别是: 一般模式:以 vi 打开一个档案就直接进入一般模式了(这是默认的模式) ...

  7. 工作中常用的Linux命令:mkdir命令

    本文链接:http://www.cnblogs.com/MartinChentf/p/6076075.html (转载请注明出处) 在Linux系统中,mkdir命令用来创建一个目录或一个级联目录. ...

  8. 工作中常用的Linux命令:crontab命令

    本文链接:http://www.cnblogs.com/MartinChentf/p/6060252.html (转载请注明出处) crontab是一个用来设置.删除或显示供守护进程cron执行的定时 ...

  9. 工作中常用的Linux命令:ipcs/ipcrm命令

    本文链接:http://www.cnblogs.com/MartinChentf/p/6057100.html (转载请注明出处) ipcs 1. 命令格式 ipcs [resource-option ...

随机推荐

  1. mysql优化方案之sql优化

    优化目标 1.减少 IO 次数 IO永远是数据库最容易瓶颈的地方,这是由数据库的职责所决定的,大部分数据库操作中超过90%的时间都是 IO 操作所占用的,减少 IO 次数是 SQL 优化中需要第一优先 ...

  2. jmeter获取mysql数据并作为请求参数使用

    1.将mysql-connector-java-5.1.22-bin.jar包放到jmeter的lib目录下,重启jmeter 2.测试计划中添加jdbc connection,右键测试计划----添 ...

  3. 对于get系列className的不兼容

    function getClass(param){ if(id.getElementsByClassName){ return id.getElementsByClassName(param); }e ...

  4. Linux命令(一)

    一:命令介绍,目录结构,基本格式 linux命令格式:   command [-options] [parameter1] ...    带-就是选项,不带-就是参数 ls ---文件显示    ls ...

  5. java的四大特性

    java的四大特性是:封装.继承.多态,抽象.

  6. MySQL中group by , sum , case when then 的使用

    在我们使用数据库的时候,可能会遇到需要进行统计的情况. 比如需要统计一下,下表中各个年份的胜负场数. 遇到这样的情况,我们应该怎么办呢? 在mysql中我们可以使用group by sum  case ...

  7. [pytorch修改]dataloader.py 实现darknet中的subdivision功能

    dataloader.py import random import torch import torch.multiprocessing as multiprocessing from torch. ...

  8. jenkins安装部署全过程

    基本配置: 1.Linux安装配置jdk环境 1.1.上传到 Linux 服务器:例如: 上传至: cd /usr/local 1.2.解压: rpm -ivh jdk-8u111-linux-x64 ...

  9. Go 函数方法

    在 Go 语言中,函数和方法不太一样,有明确的概念区分.其他语言中,比如 PHP 函数就是方法,方法 就是函数,但在 Go 语言中,函数是不属于任何结构体.类型的方法,也就是说函数是没有接收者的:而方 ...

  10. Microsoft Visual Studio已停止工作

    问题:今天在安装Visual Studio时,提示“Visual Studio installer 已停止工作” 解决办法:卸载原有的 .net  framework,在微软官网下载 .net fra ...