The input data:
mbeanName: com.sap.default:name=tc~bl~deploy_controller,j2eeType=SAP_J2EEServicePerNode,SAP_J2EEClusterNode=3620850,SAP_J2EECluster=XXX
Get attribute Properties: {undepl_parallelism_strategy=normal, deployment_forbidden=off, locking_retries=50, suppress_ds_warnings=on, locking_interval=2000, os_pass=<OS_Pass>, archives_dir_name=archives, offline_result_timeout=3600000, undepl_offline_strategy=normal, depl_parallelism_strategy=normal, wed_disp_server_info=\\<HOST>/saploc/<SID>/SYS/profile/<CLUSTER_INFO>, os_user=<OS_User>, inst_id_2_inst_pfl=<INSTANCE_ID>=\\\\<HOST>/saploc/<SID>/SYS/profile/<PROFILE>
<INSTANCE_ID>=\\\\<HOST>/saploc/<SID>/SYS/profile/<PROFILE>, suppress_fatal_ds_warnings=off, min_free_bytes_to_deploy=104857600, storage_dir_name=storage, depl_offline_strategy=normal, deploy_threads=3}
mbeanName: com.sap.default:name=tc~bl~deploy_controller,j2eeType=SAP_J2EEServicePerNode,SAP_J2EEClusterNode=3620851,SAP_J2EECluster=XXX
Get attribute Properties: {undepl_parallelism_strategy=normal, deployment_forbidden=off, locking_retries=50, suppress_ds_warnings=on, locking_interval=2000, os_pass=<OS_Pass>, archives_dir_name=archives, offline_result_timeout=3600000, undepl_offline_strategy=normal, depl_parallelism_strategy=normal, wed_disp_server_info=\\<HOST>/saploc/<SID>/SYS/profile/<CLUSTER_INFO>, os_user=<OS_User>, inst_id_2_inst_pfl=<INSTANCE_ID>=\\\\<HOST>/saploc/<SID>/SYS/profile/<PROFILE>
<INSTANCE_ID>=\\\\<HOST>/saploc/<SID>/SYS/profile/<PROFILE>, suppress_fatal_ds_warnings=off, min_free_bytes_to_deploy=104857600, storage_dir_name=storage, depl_offline_strategy=normal, deploy_threads=3}
The awk statement:
awk 'BEGIN {
FS = ","
}
{
if ($1 ~ /mbeanName:/) {
substring1 = $3
} else if ($1 ~ /Get attribute Properties:/) {
substring2 = $2
}
}
END {print substring1 substring2}'
But the output only shows:
SAP_J2EEClusterNode=3620851 deployment_forbidden=off
Desired output:
SAP_J2EEClusterNode=3620850 deployment_forbidden=off
SAP_J2EEClusterNode=3620851 deployment_forbidden=off
I know I need to put the substrings in an array so that I can print all the occurrences of substring1 and substring2, but I am not familiar with the awk syntax.
Please advise if you happen to stumble on this thread. Thanks in advance.