Search for Ip in last

I need to grep for for ipaddress in last , the ipaddress could also be with 60.120.123.26

174.20.195.150

last | awk '{print $3}' | grep [0-9*]

It ain't working

last | awk '$3 ~ /[0-9.]/ {print $3}'

replace [0-9.] with the regex for ip addr if you want valid ips only

HTH,
PL

Does not work when the server name is like

abc2dev1

---------- Post updated at 12:57 PM ---------- Previous update was at 12:31 PM ----------

Got it
last | awk '$3 ~ /^[0-9.]/ {print $3}'

Is there a need to chk the ip addr regex or is it just to remove the last line thrown by last command.

If the latter is the case then try this

last | awk '$0 !~ /begins/ {print $3}'