'What does ip address | sed -ne 's/^\s*inet \([0-9]\+\).*$/IP:\1/p' mean?

On Ubuntu 14.04 I'm trying to get only the IP address of my computer in a .csv format.



Solution 1:[1]

This sed command may be what you're trying to do

ip address |
sed -n -e '/^[[:blank:]]*inet[[:blank:]]/{s///; s/\/.*//; H;}' \
       -e '${g; s/./"/; s/\n/","/g; s/$/"/p;}'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1