5、处理/etc/fstab路径,使用sed命令取出其目录名和基名

5、处理/etc/fstab路径,使用sed命令取出其目录名和基名
[17:06:46 root@CentOS8 ~]#echo /etc/fstab
/etc/fstab
[17:07:08 root@CentOS8 ~]#echo /etc/fstab |sed -nr 's#(.*)/([/]+)/?$#\1#p'
[17:09:04 root@CentOS8 ~]#echo /etc/fstab |sed -nr 's#(.*)/([/]+)/?$#\2#p'

posted @ 2022-04-18 16:30  惊起千层浪  阅读(70)  评论(0)    收藏  举报