95

sed基本用法(图片)-大宝天天见-51CTO博客

 7 years ago
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.
neoserver,ios ssh client

sed基本用法(图片)

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

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK