in reply to update winxp hosts file with new IP address

...and finding the default IP address and replacing it with the new value.
What do you mean by 'default IP address'? What hostname is it associated with?

Since the hosts file shouldn't change that much, here's a simple approach that might work for you:

  1. Create a copy of the hosts file without the default ip address entry. Call this file hosts-base
  2. When the default IP address needs to changed, copy hosts-base to hosts and append the new default address entry.
The script to perform step 2 can even be a .bat file, but here's a perl script:
open(B, "<c:/path/to/hosts-base"); open(N, ">c:/path/to/hosts"); while (<B>) { print N; } print N "default $ARGV[0]\n"; # add the 'default' entry
If the default IP address is limited to a couple of different choices, then you can just prepare one host file for each possible value for the default IP address, and copy the desired file to the real hosts file as required.