Skip to content
Advertisement

Grep regexp for matching ip addresses in a file

I’m trying to search a file “Sessions” that contains IP addresses (among other useless junk). My Grep is failing to match, even though REGEXR is matching perfectly all the IPs perfectly … so I know the REGEX is correct … but when I GREP for this same pattern, not is returned.

JavaScript

I’ve tried a variation of ways on that GREP (without the long options)

JavaScript

I don’t understand. I’ve read the man page and also tried egrep as well. Here is a sample of what I’m searching …

JavaScript

Advertisement

Answer

You aren’t escaping your { and } with as you should, also you probably want to use -o for “only show match”

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement