Redhat 7 scripting question
Dear gods of linux is there a one liner I can use to show a ip address of a system and by using awk and cut wizadry cut down the output to show just the ip address
So I can then create a menu driven script that can be used on all systems to show a i.p addr
So I can then create a menu driven script that can be used on all systems to show a i.p addr
Microsoft's strategy to conquer the I.T industry
" Embrace, evolve, extinguish "
" Embrace, evolve, extinguish "
Comments
-
masq Member Posts: 33 ■■□□□□□□□□Hi.
You didn't provide enough info about your systems, whether they're ipv4 or ipv6, number of network interfaces, etc..
But I guess this should work for you:$ ip addr | grep -Ei "inet.*eth[[:digit:]]" | tr -s " " | cut -f 3 -d " " | cut -f1 -d"/"
2018:- RHCE
-
ally_uk Member Posts: 1,145 ■■■■□□□□□□Hey one network interface using ipv4 ethernet.
Thank you for the reply would also be interesting to see some other solutions perhaps with using awk.
Thats the beauty of Linux so many ways of getting things done.Microsoft's strategy to conquer the I.T industry
" Embrace, evolve, extinguish "