访问手机版  

Linux常用命令|Linux培训学习|考试认证|工资待遇与招聘,认准超级网工!

招聘|合作 登陆|注册

网络工程师培训

当前位置:网络工程师 > 技术课程 > linux > 热点关注 > linux常用命令

Linux命令行与Shell脚本编程大全-sed奇淫技巧

时间:2019-07-10

linux命令大全_红帽linux命令大全_linux命令大全

本章内容:

# tail /etc/services
nimgtw         48003/udp               # Nimbus Gateway
3gpp-cbsp       48049/tcp               # 3GPP Cell Broadcast Service Protocol
isnetserv       48128/tcp               # Image Systems Network Services
isnetserv       48128/udp               # Image Systems Network Services
blp5           48129/tcp               # Bloomberg locator
blp5           48129/udp               # Bloomberg locator
com-bardac-dw     48556/tcp               # com-bardac-dw
com-bardac-dw     48556/udp               # com-bardac-dw
iqobject        48619/tcp               # iqobject
iqobject        48619/udp               # iqobject
#seq 10 | sed -n '1~2p'
1
3
5
7
9
# tail /etc/services |sed -n '/blp5/,+1p'
blp5            48129/tcp               # Bloomberg locator
blp5           48129/udp               # Bloomberg locator
# tail /etc/services |sed -n '$!p'
3gpp-cbsp       48049/tcp               # 3GPP Cell Broadcast Service Protocol
isnetserv       48128/tcp               # Image Systems Network Services
isnetserv       48128/udp               # Image Systems Network Services
blp5            48129/tcp               # Bloomberg locator
blp5            48129/udp               # Bloomberg locator
com-bardac-dw   48556/tcp               # com-bardac-dw
com-bardac-dw   48556/udp               # com-bardac-dw
iqobject        48619/tcp               # iqobject
iqobject        48619/udp               # iqobject
#感叹号也就是对后面的命令取反。
# tail /etc/services  |sed -n '/^blp5/,/^com/p'
blp5            48129/tcp               # Bloomberg locator
blp5            48129/udp               # Bloomberg locator
com-bardac-dw   48556/tcp               # com-bardac-dw
#以逗号分开两个样式选择某个范围