commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
regex to match an ip
There is 1 alternative - vote for the best!
This obey that you don't match any broadcast or network addresses and stay between 18.104.22.168 - 254.254.254.254
if you want to only print the IP address from a file.
In this case the file will be called "iplist" with a line like "ip address 22.214.171.124"
it will only print the "126.96.36.199" portion
Handles everything except octets with 255. Ran through ip generator with variable octet lengths.
If you can do better, submit your command here.
You must be signed in to comment.