

sed基本用法(图片)-大宝天天见-51CTO博客
source link: http://blog.51cto.com/13587169/2066388
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

sed基本用法(图片)

练习
1.把Jon的名字改成Jonathan
sed -i 's/Jon/Jonathan/g' datafile2
2.删除头三行
sed '1,3d’ datafile2
3.显示5-10行
sed -n '5,10p' datafile2
4.删除包含Lane的行
sed '/Lane/d' datafile2
5.显示所有生日在November-December之间的行
sed -nr '/:(11|12)\//p' datafile2
6.把三个星号()添加到也Fred开头的行
sed '/^Fred/i' datafile2
7.用JOSE HAS RETIRED取代包含Jose的行
sed 's/Jose/JOSE HAS RETIRED/g' datafile2
8.把Popeye的生日改成11/14/46
sed 's#3/19/35#11/14/46#g' datafile2
9.删除所有空白行
sed '/^$/d' datafile2
Recommend
-
92
1.调用外部变量user="tomrootstudent"foriin$userawk-F:-vx=$i'$1=x{print$2}'/etc/passwd####指令内无需$引用2.awk结果赋值x=yumrepolist|awk'/repolist:/{if($2==0){print1}else{print0}}'###取命令结果:``或者$
-
82
部署LNMP 1.安装NginxNginx代码编译需要的软件包yum -y install gcc pcre-devle openssl-devle zlib-devel make其他省略2.安装MariaDByum -y install mariadb-server mariadb m...
-
78
原创 DNS服务基础
-
74
输入字符串,任何数据都是字符串int(raw_input("字符串"))字符串转数字脚本:#!/usr/bin/python#coding:utf-8user=raw_input("请输入用户名:")print"Welc
-
81

-
67

-
3
%f与%lf的区别和用法 精选 原创 鱼要钓鱼 2022-10-21 18:16:49...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK