搜索字符串“%s_sitename截止日期”+%Y-%b-%e“”每当我们执行abc.ksh时,sysdate更改日期
s1='%s_sitename%[a-z][0-9]/-'
s2='%s_sitename%'"$(date "+%Y-%b-%e")"
sed -i 's/'"$s1"'/'"$s2"'/g' xyz.sql
每次使用sysdate更新abc.sql文件
"%s_sitename% as of 2016-Jun-22"
随着电流的到来,我得到如下的有线输出
答案 0 :(得分:0)
s1='%s_sitename% as of [a-zA-Z0-9-]*'
s2='%s_sitename% as of '"$(date "+%Y-%b-%e")"
sed -i 's/'"$s1"'/'"$s2"'/g' xyz.sql
测试:
echo "%s_sitename% as of 2005-Apr-02" | sed 's/'"$s1"'/'"$s2"'/g'
输出:
%s_sitename% as of 2016-Jun-26