Re: extracting an IPv4 address from text?
- Reply: Ralf Mardorf : "Re: extracting an IPv4 address from text?"
- In reply to: Robert Huff : "extracting an IPv4 address from text?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 02 Apr 2022 22:17:26 UTC
On 4/2/22 15:10, Robert Huff wrote: > Hello: > Let's suppose I want to parse a line from auth.log and extract > the IP address (if any) to stdout. > I'm assuming there is a robust way to do this using standard > command-line tools ... but my brain is flailing on the exact method. > Anyone have a example they'd be willing to share? Or is this a > problem already solved? > > > Hopefully, > > > Robert Huff > > > > > > If perl is available: $ perl -MRegexp::Common='net' -n -e "print if $_ =~ $RE{net}{IPv4}" /path/to/logfile Edgar