Extracting IP addresses

I rarely use AppleScript, but every once in awhile I run into something that requires it, the first thing I do is look in the AppleScript book, when that fails I ask you guys. Thank you all.

I have a txt file (log analyzer output) that contains, among other things (mixed text and numbers) a few thousand IP addresses. I don’t care about the other stuff, all I want is a list of IP addresses. And so the question is, how would I got about doing this?

There are a lot of ways to do this. Your best bet is to use a regular expression parser (either an OSAX or through a shell script call to something such as Perl). That said, here’s an incredibly basic (and slow) vanilla AppleScript routine for extracting IPs from a block of text:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Excellent, thank you.