An IP address of the several methods

1, with the sed command to get the address 192.168.52.20

ifconfig ens33|sed -n '2p'|sed 's#^.*inet ##g'|sed 's#  netmask.*$##g'

Ideas: first take the second row, and then remove the front to take the key characters, and then remove the following character, (replaced with a null) can be derived

Note: sed command between only the first and second # can use regular expressions

Guess you like

Origin www.cnblogs.com/zhutao-niuniu2014/p/11267847.html