Results 1 to 2 of 2
Hi,
During an installation process in a bash script I need to do 2 things with 2 XML files. Does the use of sed affect in any way the XML ...
- 05-27-2009 #1Just Joined!
- Join Date
- Mar 2008
- Posts
- 30
XML file modifications using sed
Hi,
During an installation process in a bash script I need to do 2 things with 2 XML files. Does the use of sed affect in any way the XML file ?
1.Add to a section in <ServerListeners> section
The below code does the job, but it doesn;t format the xml file by adding tabs and all. Is that ok from an XML file point of view?Code:<ServerListener> <BaseClass>myapp.module.WowConfigurator</BaseClass> </ServerListener>
Code:ISLISTENER=`grep -n "myapp" $WOW_HOME/conf/Server.xml|cut -d":" -f1 |head -1` if [ ${ISLISTENER} == "" ] then INSERTLINE=`grep -n "ServerListeners" $WOW_HOME/conf/Server.xml|cut -d":" -f1 |head -1` sed -e ''${INSERTLINE}'a\</ServerListener>''' $WOW_HOME/conf/Server.xml > $WOW_HOME/conf/Server.xml_new mv $WOW_HOME/conf/Server.xml_new $WOW_HOME/conf/Server.xml sed -e ''${INSERTLINE}'a\<BaseClass>myapp.module.WowConfigurator</BaseClass>''' $WOW_HOME/conf/Server.xml > $WOW_HOME/conf/Server.xml_new mv $WOW_HOME/conf/Server.xml_new $WOW_HOME/conf/Server.xml sed -e ''${INSERTLINE}'a\<ServerListener>''' $WOW_HOME/conf/Server.xml > $WOW_HOME/conf/Server.xml_new mv $WOW_HOME/conf/Server.xml_new $WOW_HOME/conf/Server.xml fi
2. With a sed command I need to replace the value of a first occurrence of a parameter:
The xml file contains:
And I need to replace with $BINDADDRESS and $BINDPORT variables. This I didn't manage to figure it out.Code:<IpAddress>*</IpAddress> <Port>1935</Port>
Thanks,
Bianca
- 06-03-2009 #2Just Joined!
- Join Date
- Mar 2008
- Posts
- 30
Hi,
Fixed


Reply With Quote