001、
[root@PC1 test3]# echo "Hello, my name is aming."|grep -P '(?<=Hello, ).*(?= aming.)' Hello, my name is aming.
002、
[root@PC1 test3]# ifconfig | grep -P '(?<=inet).*(?=netmask)' inet 192.168.184.128 netmask 255.255.255.0 broadcast 192.168.184.255 inet 127.0.0.1 netmask 255.0.0.0 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
。
ref:
01:https://blog.51cto.com/u_15127506/4147133