Re: Router's IP address - how to grep
Re: Router's IP address - how to grep
- Subject: Re: Router's IP address - how to grep
- From: Joe <email@hidden>
- Date: Thu, 15 May 2008 14:40:50 -0700
Mark J. Reed wrote:
Looks like you left in the [^0-9]* at the front.Take that out - that
just allows for stuff between the colon and the IP. (the ^ in [^0-9]
means "not", so the whole thing means "anything that's not a number").
The IP address itself starts with the [0-9]* after it.
But note that it will match every IP-address-like string in the
output, of which there may be more than one...
Fortunately there is only one line like that. It works perfectly. Here
is the whole script:
copy (current date) to b
set x to month of b as number
set timeStamp to (x as text) & "/" & day of (current date) & "/" & ¬
text -4 thru -1 of (year of (current date) as text) & tab & time
string of (current date)
set theurl to "http://homeportal/xslt?
PAGE=B01&THISPAGE=A01&NEXTPAGE=B01"
set routerIP to do shell script "/usr/local/bin/lynx -dump " & quoted
form of theurl & " | grep -o '[0-9]*\\.[0-9]*\\.[0-9]*\\.[0-9]*' "
set IPinfo to routerIP & tab & timeStamp & return
set thisref to open for access file ((path to desktop folder as text)
& "ips") with write permission
write IPinfo to thisref starting at eof
close access thisref
Thanks Mark
Joe _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden