Perhaps something like this?
C:\>set TEST=^<setting name="hostname" value="servername.companyname" /^>
C:\>for /f "tokens=1,2,3 delims=/=" %a in ("%TEST%") do set HNa=%~c && set
HN=%HNa:"=%
C:\>echo %HN%
servername.companyname
J
On 10 February 2015 at 11:27, John Tullis <user-a6bbfd057f07@xymon.invalid> wrote:
I am managing a XYMON server of about 500 servers across different
locations and networks. We've made the setup work well but I'm not starting
to experiment with externals scripts. Because our network is so spread out,
we have configured each host to have a unique hostname set up in the config
file on each host using the pattern: servername.companyname. This isn't an
issue until I need to feed the hostname back to the server in a custom
script. Is there anything in bbwin.exe that will let me query for the
hostname set in the .\etc\bbwin.cfg file and spit it out somewhere?
I've also found a way to use findstr to look for the hostname line in the
file but am having trouble using batch to remove everything from the line
than just the hostname. It's returning <setting name="hostname"
value="servername.companyname" /> but I don't have enough experience to
narrow it down any further than that (primarily through batch files).
Any advice would be extremely helpful.
Thanks,
John