ip addr|awk '/inet /{gsub(/\/.*/," " ,$2);print $2}'
ip addr displays the local ip address
awk中'/inet/{gsub (/\.*/," ",$2);print $2}'
Match a line containing inet spaces, and replace the characters in/after the second field in the matched line with spaces, and then print the second field
The gsub function is equivalent to the sed command sed 's///g' in bash