Hello,
I'm trying quickly dig through our VPN logs for a list of class A ips , and I'm having trouble. I have a file with a list of numbers, one per line. I'm wanting to incorporate each number into an extended regex:
Code:
for i in `cat ips`; do zgrep -E '[[:space:]]$i(\.[0-9]{1,3}){3}[[:space:]]' vpn1/2009.08.20.log.gz; done
If I substitute one of the numbers in for $i, it works for that number. For example:
Code:
for i in `cat ips`; do zgrep -E '[[:space:]]58(\.[0-9]{1,3}){3}[[:space:]]' vpn1/2009.08.20.log.gz; done
I think the loop is passing literally "$i" to zgrep instead of its value due to the tics, and I can't figure out how to resolve this. I can't remove the tics b/c zgrep doesn't like that. Putting a backslash in front of $i doesn't work. Any ideas?
Oh, and the number loop seems to be working fine:
Code:
for i in `cat ips`; do echo $i; done
1
14
27
43
58
59
60
61
110
111
[...]
Thanks for any assistance!