以下のように、 myfile.txtとresponsefile.txtという 2 つのファイルがあります。
myfile.txt
user=myname
Was_WAS_AdminId=CN=wsadmin,OU=service,OU=WAS_Secure,OU=tb,ou=dcdc,ou=sysadm,dc=info,dc=prd,dc=dcdc
応答ファイル.txt
'#'Please fill the user id details.
'#'Here is example user=urname.
user=
'#'Please fill the details.
'#'Here is example Was_WAS_AdminId=CN=wsadmin-xxxx.
Was_WAS_AdminId=
ここで、上記の 2 つのファイルを使用すると、一致するパターンを置き換えた後、次の最終結果が得られます。responsefile.txt の内容はそのままで、一致したパターンに myfile.txt で提供される詳細をプレフィックスとして付けるか、最初のパターンが両方のファイルで同じであり、100 以上のパターンになるため、一致する行全体のみを置き換える必要があります。SO、簡単な解決策を提案してください。
responsefile.txt (新しいファイルを置換/パターンで置換)
'#'Please fill the user id details.
'#'Here is example user=urname.
user=myname
'#'Please fill the details.
'#'Here is example Was_WAS_AdminId=CN=wsadmin-xxxx.
Was_WAS_AdminId=CN=wsadmin,OU=service,OU=WAS_Secure,OU=tb,ou=dcdc,ou=sysadm,dc=info,dc=prd,dc=dcdc
パターンは両方のファイルで同じです。たとえば、両方のファイルで " user=
" または " Was_WAS_AdminId=
" です。