Only get the first part of grep: get ip of ifconfig

Job*_*obs 1 linux bash shell grep ifconfig

ifconfig | grep -m1 "inet addr" 
Run Code Online (Sandbox Code Playgroud)

Gives me

inet addr:172.30.1.6  Bcast:172.30.140.255  Mask:255.255.252.0
Run Code Online (Sandbox Code Playgroud)

However, I only want the ip, which is 172.30.1.6. How can I do this? Note that I have to be using ifconfig, as this is an embedded system with limited functionalities.

Tom*_*now 5

Get out your scissors, it's cuttin' time.

echo inet addr:172.30.1.6  Bcast:172.30.140.255  Mask:255.255.252.0 | cut -d : -f 2 | cut -d " " -f 1
Run Code Online (Sandbox Code Playgroud)