Re: More Mac Ghost
Re: More Mac Ghost
- Subject: Re: More Mac Ghost
- From: "Christopher C. Stone" <email@hidden>
- Date: Tue, 21 Nov 2000 23:37:48 -0600
>
I need applescript to read the file and search for a string (the Ethernet address) and return the name of the machine as the result (I may have to reverse it eg. first the Ethernet address then the name if it would be easier) the Ethernet address is separated from the name with a tab.
Hey Phil,
There are quite a few ways to accomplish this:
-- Faux read file
set dta to "Business01 00:50:E4:1E:0E:15
Business02 00:50:E4:1E:1C:6F
Business03 00:50:E4:AE:0E:3D
Business04 00:50:E4:CE:22:4F
Business05 00:50:E4:1E:E4:3E"
-- Tanaka's Osax
set r to (MT Pick Lines dta keyword "00:50:E4:1E:E4:3E") as string
set AppleScript's text item delimiters to {tab}
set r to text item 1 of r
set AppleScript's text item delimiters to {""}
r
-- RegEx Commands Osax
set findString to "00:50:E4:1E:E4:3E"
set itm to REMatch dta pattern "(.+)\\t" & findString using "\\1"
-- Akua Sweets
set x to collect lines of dta that match "*00:50:E4:1E:E4:3E"
set x to item 1 of item 1 of (decompose x by tab)
Best Regards,
Chris
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Christopher C. Stone
StoneWorks Computer Consulting
email@hidden
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~