Re: extracting an IPv4 address from text?
- In reply to: Edgar Pettijohn : "Re: extracting an IPv4 address from text?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 02 Apr 2022 22:29:44 UTC
On Sat, 2 Apr 2022 17:17:26 -0500, Edgar Pettijohn wrote: >If perl is available: > > >$ perl -MRegexp::Common='net' -n -e "print if $_ =~ $RE{net}{IPv4}" >/path/to/logfile In a previous reply I didn't provide the full quote, but here it is: "If you find yourself needing a feature that is very difficult or impossible to do in AWK, I suggest you either use NAWK, or GAWK, or convert your AWK script into PERL using the "a2p" conversion program which comes with PERL." - https://www.grymoire.com/Unix/Awk.html However, all of us are used to shell scripts. I wasn't aware that perl provides the solution the OP is asking for. A solution using a POSIX (portable) shell script would be nice, too.