Extract IP addresses with grep



Published: 2017-10-05 09:33:46 +0000
Categories: BASH,

Language

BASH

Description

Simple grep patterns to extract ip addresses

Snippet

# IPv4
grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'

# IPv6
grep -o -P "([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4}"

Keywords

ip, grep, identify, extract, ipv4, ipv6, address,

Latest Posts

Remotely backing up PFsense Configuration (BASH)
FFMPEG: Converting RMVB to X264 MP4 (BASH)
Recursively print table (print_r equivalent) (LUA)
Bulk Delete Comments from (Self-Hosted) JIRA Issues (Misc)
Add a static entry to the ARP table (BASH)
SSL Cipher Hex codes to Human Readable Names (Misc)
Convert Ascii to Binary (BASH)
Intercepting Outbound DNS Queries (BASH)
Handle Google Verification files within NGinx Configuration (NGinx)
Getting WhatsApp Rich Snippet Previews Working (Misc)

Copyright © 2018 Ben Tasker | Sitemap | Privacy Policy
Available at snippets.bentasker.co.uk and snippets.6zdgh5a5e6zpchdz.onion