From your comment:
I'm basically trying to run a script as soon as my iPhone comes within range of my home network to turn a light on. Any ideas? Someone else had suggested using sed.
This sounds like a fun project!
You could do this by polling every 1 or 2 seconds with a ping. It's a bit of a kludge, but the pings will cause negligible overhead.
Configure your DHCP server to always hand out the same IP to your iPhone (based on its MAC address)
Run a script on your linux computer that attempts to ping that IP every n seconds.
Turn your lights on/off based on some simple ping-response criteria
If you had a monitoring application like Zabbix, you could do this really easily. You would set up a ping test for your iPhone, and create a trigger that runs an external script (to turn the light on/off). Zabbix is overkill if this is all you're using it for, but you could come up with some other uses as well, I'm sure. :)
Also, in your script/trigger logic, you should make an attempt to avoid flicker. The light should be switched on as soon as 1 ping gets a response. It should only turn off after pings have gone unresponded for a full 5 minutes. That way, your lights won't be flickering on and off when you have network congestion.