cat airwar-config.xml
<?xml version="1.0" encoding="utf-8"?>
<LoaderMax name="dynamicLoaderMax" lang="VI">
        <SWFLoader name="loading" url="loading.swf" v="1.1.1.0"/>
    <SWFLoader name="main" url="AirBattleOct.png" v="1.2.2012.08.21.19"/>
    <SWFLoader name="login" url="AirLogin.swf" v="1.2.2012.08.21.19"/>
    <SocketSevers>

  1. sed -i '4,5s/v=".*"/v='\"1.2.`date +%Y.%m.%d.%H`\"'/g' /data/fkzj/airwar-config.xml 

附加也可以这样,不过本人比较懒惰

 

  1. echo 'v="1.2.201208160788"' | sed "s/v=\"1\.2\.[0-9][0-9]*\"/v=\"$(date '+%Y%m%d%H%M%S')\"/" 
  2. v="20120821202654"