UUID=89ec9224-65c7-4461-9350-9d5e016d016c / xfs defaults 0 0
UUID=1b0c5c77-c343-4139-9533-0ef66ffe5d39 /boot xfs defaults 0 0
UUID=e70e4b66-c716-4d00-a483-4771fea4a9c1 /testdir xfs defaults 0 0
UUID=6cfc5ecc-625f-4a4c-936f-95e4bab93dd6 swap swap defaults 0 0
[root@CentOS7 ~]#
5.显示奇数行
[root@CentOS7 ~]# sed 'n;d' fstab
# This is one line.
# This is three line.
# /etc/fstab
#
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
UUID=89ec9224-65c7-4461-9350-9d5e016d016c / xfs defaults 0 0
UUID=e70e4b66-c716-4d00-a483-4771fea4a9c1 /testdir xfs defaults 0 0
[root@CentOS7 ~]#
在sed命令中引入shell变量
Linux高级文本处理工具之sed
Linux常用命令:sed