Hi,
I have a ksh script which looks through various logs for the ip address pattern as well as email address pattern and other pattern still to be defined. How do I extract the found patterns from the file? I tried using awk but it seems that I need to know the position of the found pattern to get a proper output:
For instance, I tried this:
cat file.txt | awk '/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/{print $5}'
but this assumes that the ip is found in the fifth position in the file (this doesn't happen all the time).
How do I extract just the item i want?
I tried this also but I'm not sure how to do the print part of the statement:
cat file.txt | awk '/\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\)/{print \1}'
I don't think my awk knows about "\1".... or maybe this is only good for sed?
sed -e "s/^.*(\b(?:(?:25[0-5]|2[0