我有一个包含解密密码的文件{ KRZ_CONN_PASSWORD=\{AES256:keyfile:a\}9deIfknH7AA3hg+i95mcWg\=\= }
,我需要将其替换为下面的新解密密码
{ KRZ_CONN_PASSWORD=\{AES256:keyfile:a\}UEum+VN9OGFGR/SwTBahgA\=\= }
实际文件:
INSTANCE=s0100r00 [ SECTION=customdefault [ ] SECTION=default [ { KRZ_ORACLE_HOME=/appl/oracle/s0100r00/product/11.2.0.4 } { KRZ_CONN_PASSWORD=\{AES256:keyfile:a\}9deIfknH7AA3hg+i95mcWg\=\= } { KRZ_CONN_USERID=itm6_ag } ]
预期结果:
INSTANCE=s0100r00 [ SECTION=customdefault [ ] SECTION=default [ { KRZ_ORACLE_HOME=/appl/oracle/s0100r00/product/11.2.0.4 } { KRZ_CONN_PASSWORD=\{AES256:keyfile:a\}UEum+VN9OGFGR/SwTBahgA\=\= } { KRZ_CONN_USERID=itm6_ag } ]
答案1
sed 's|\({ KRZ_CONN_PASSWORD=\\{AES256:keyfile:a\\}\)[^ ]*|\1UEum+VN9OGFGR/SwTBahgA\\=\\=/g'