| |||||||||||
| |||||||||||
hostname substitution to form url in xml Posted by thierry (thierry), 22 December 2008 I have inherited a lovely Nagios install where webinject (http://www.webinject.org/plugin.html) is used to run a series of 20 odd test cases. Each test case is based on an xml file that contaisn the following stanza: url=http://$hostname:port/path_to_app In their great wisdom the local guys have decided to copy/paste/edit these xml so they have a set of files for each and every $hostname resulting in hundreds of files... I _know_ there is a better way to do this if I could only learn/understand how to programmaticaly replace $hostname for each server I need to runsaid test for. Any pointer would be great Thierry Posted by KevinAD (KevinAD), 24 December 2008 it is possible to expand a scalar variable in a file using a regular expression with the e option:my $hostname = 'example.com'; my $text = 'url=http://$hostname:port/path_to_app'; $text =~ s/(\$hostname)/$1/eeg; How you apply that to your spefic requirements is the trick. This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |