[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. day03 Python字典dict的增删查改及常用操作

    字典是python中唯一的映射类型,采用键值对(key-value)的形式存储数据.python对key进行哈希函数运算,根据计算的结果决定value的存储地址,所以字典是无序存储的,且key必须是可 ...

  2. python SyntaxError: Non-ASCII character '\xe6' in file

    [1]python程序执行报错 报错:SyntaxError: Non-ASCII character '\xe6' in file /tmp/788580473/main.py on line 7, ...

  3. eclipse无法断点调试JDK源码的问题

    最近换了新版的eclipse,在jdk源码里面,打断点发现无法进入源码调试,程序直接跳过,已查资料发现自己eclipse配置的是jre环境的. 此处要配成jdk目录才有效 打开preferences, ...

  4. 教你如何在win7中的cygwin64下安装hadoop

    首先我们要准备如下环境及软件: win7(64位) cygwin - jdk-6u25-windows-x64.zip hadoop-.tar.gz 1.在win7系统上正常安装jdk,同时注意设置好 ...

  5. WIFI CAT ET III Adapter Caterpillar ET3 New Arrival

    The old bluetooth cat et adatper iii has stopped production, and you can get the new WIFI CAT Caterp ...

  6. java实现zip压缩和解压工具

    引入ant.jar package com.develop.web.util; import java.io.BufferedInputStream; import java.io.File; imp ...

  7. oracle flashback data archive闪回数据归档天坑之XID重用导致闪回查询数据重复

    我们有个系统使用了Oracle flashback data archive闪回数据归档特性来作为基于时间点的恢复机制,在频繁插入.更新期间发现SYS_FBA_HIST_NNNN表中的XID被两个事务 ...

  8. 安装win10 和win中的一些杂项问题

    reg中的 policies是政策/策略, 主要是指 控制面板中的一些控制项目, 其中 explorer是 控制面板的 显示项目... DWORD值是一个32位(4个字节:即双字)长度的数值, 是数字 ...

  9. HADOOP HA 踩坑 - org.apache.hadoop.hdfs.qjournal.protocol.JournalNotFormattedException: Journal Storage Directory /mnt/data1/hadoop/dfs/journal/hdfscluster not formatted

    报错:在journalnode的log中: org.apache.hadoop.hdfs.qjournal.protocol.JournalNotFormattedException: Journal ...

  10. 基本设置_common_setting

    comment(备注) ID(请勿修改) Param(参数) 说明与格式 积分物品ID设置 1 60000 积分属性虚拟货币,存储在Auth库account表TokenAmount字段. 这里设置积分 ...