General

Find IP Addresses with awk

An Internet Protocol address – or IP address for short – is a series of unique numbers that are assigned to each router or hotspot accessing the internet. The string of numbers is used to tell all the machines apart on the same internet. Much like your house needs a mailing address to send and receive packages or letters, your device – whether it’s a computer, a phone or something else – needs an IP address to send and receive data.

AWK is a special-purpose programming language designed for text processing and typically used as a data extraction and reporting tool. It is a standard feature of most Unix-like operating systems.

IPv4 example:

awk '{match($0,/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/); ip = substr($0,RSTART,RLENGTH); print ip}'