Tuesday, March 22, 2011

stream editing shell/php

place var1,var2,.... inside common file tempale.xml which u need to add values automatically,
eg :- config file with 2 variables, user_name=VAR1 and path=VAR2

inside php file,

$username='udara';
$path='/var/www/mobsync';
$create='cat tempale.xml | sed -e "s/VAR1/'.$username.'/g" | sed -e "s/VAR2 /'.$path.'/g" > template_new.xml';
exec($create);

No comments:

Post a Comment