* [gentoo-user] OT - Extracting IP addresses with grep
@ 2006-10-12 18:51 Michael Sullivan
2006-10-12 19:50 ` Willie Wong
0 siblings, 1 reply; 2+ messages in thread
From: Michael Sullivan @ 2006-10-12 18:51 UTC (permalink / raw
To: gentoo-user
I have a mail directory with several hundred spammish emails that have
been collecting over the past month. I haven't gotten around to
processing them yet (abuse@isp.net if available, blocked if not) I
would like to write a script that would extract the IP addresses from
all these emails, but I can't figure out how to get grep to cooperate.
I created a perl regular expression for matching against IP addresses
and tried to pass it to grep, but it wouldn't return anything. I don't
know what I'm doing wrong. Here's my command:
michael@bullet ~/.maildir/.SPAM/cur $ cat * | grep -P m/\d+\.\d+\.\d
+\.\d+/
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [gentoo-user] OT - Extracting IP addresses with grep
2006-10-12 18:51 [gentoo-user] OT - Extracting IP addresses with grep Michael Sullivan
@ 2006-10-12 19:50 ` Willie Wong
0 siblings, 0 replies; 2+ messages in thread
From: Willie Wong @ 2006-10-12 19:50 UTC (permalink / raw
To: gentoo-user
On Thu, Oct 12, 2006 at 01:51:05PM -0500, Michael Sullivan wrote:
> michael@bullet ~/.maildir/.SPAM/cur $ cat * | grep -P m/\d+\.\d+\.\d
> +\.\d+/
You might want the expression in quotes to prevent bash from intercepting
those backslashes.
grep -P '\d+\.\d+\.\d+\.\d+'
HTH,
W
--
Willie W. Wong wwong@math.princeton.edu
408 Fine Hall, Department of Mathematics, Princeton University, Princeton
A mathematician's reputation rests on the number of bad proofs he has given.
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-10-12 19:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-12 18:51 [gentoo-user] OT - Extracting IP addresses with grep Michael Sullivan
2006-10-12 19:50 ` Willie Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox