Sed网卡取IP
[root@centos8 ~]#ifconfig ens160|sed -n '2p'|sed 's/^.*inet //'|sed 's/ .*//'
[root@centos8 ~]#ifconfig ens160|sed -rn '2s/^([^0-9]+)([0-9.]+)( .*)$/\2/p'
[root@centos8 ~]#ifconfig ens160|sed -rn '2s/^[^0-9]+([0-9.]+) .*$/\1/p'
=ifconfig |sed -rn "2s/[^0-9]+([0-9.]+) .*$/\1/p"
#ifconfig |sed -n '2s/^.*inet //;s/netmask.*//p'
#ifconfig |sed -n '2s/^.*inet //p' |sed -n 's/netmask.*//p'
#ifconfig |sed -En '2s/^[^0-9]+([0-9.]+).*$/\1/p'
#ifconfig |sed -nr '2s/^[^0-9]+([0-9.]{7,15}).*/\1/p'
#ifconfig |sed -nE '2s/[^0-9]+([0-9.]+).*/\1/p'
#ifconfig |sed -nr '2s/[^0-9]+([0-9.]+).*/\1/p'
#ifconfig eth0 |sed -nr '2s/(.*inet) ([0-9].*) (netmask.*)/\2/p'