But i find duplicate output i need to keep only the line with DR and T1 prefix updated
Server1|poweredOn|T1|268401|[Z0109-GEN-SFCHT1-VMS-R001SR] Server1/Server1.vmx|Red Hat Enterprise Linux 5 (64-bit)
Server1|poweredOn|DR|T1|268401|[Z0109-GEN-SFCHT1-VMS-R001SR] Server1/Server1.vmx|Red Hat Enterprise Linux 5 (64-bit)
Your request is not too specific; try and adapt if it doesn't fit:
sed -r '/SFCHT1.*SR/ s/^([^|]*\|){2}/&DR|T1|/' file
Server1|poweredOn|DR|T1|268401|[Z0109-GEN-SFCHT1-VMS-R001SR] Server1/Server1.vmx|Red Hat Enterprise Linux 5 (64-bit)
Here is another solution. I'm thinking that SR and SFCHT1 should only be matched between [ and ] :
sed -e '/[[][^]]*SFCHT1[]-]/s/poweredOn/poweredOn|T1/' \
-e '/[[][^]]*SR[]-]/s/poweredOn/poweredOn|DR/' file.csv
Example:
$ file.csv
Server1|poweredOn|268401|[Z0109-GEN-SFCHT1-VMS-R001SR] Server1/Server1.vmx|Red Hat Enterprise Linux 5 (64-bit)
Server2|poweredOn|268401|[Z0110-DSP-SFCHT1-VMS-R001SM] Not SR/Server1.vmx|Red Hat Enterprise Linux 3.2 (32-bit)
Server3|poweredOn|268401|[Z0109-XXX-PFCHT2-VMS-R001SM] Not SR or SFCHT1/Server1.vmx|Solaris 3.2
$ sed -e '/[[][^]]*SFCHT1[]-]/s/poweredOn/poweredOn|T1/' \
-e '/[[][^]]*SR[]-]/s/poweredOn/poweredOn|DR/' file.csv
Server1|poweredOn|DR|T1|268401|[Z0109-GEN-SFCHT1-VMS-R001SR] Server1/Server1.vmx|Red Hat Enterprise Linux 5 (64-bit)
Server2|poweredOn|T1|268401|[Z0110-DSP-SFCHT1-VMS-R001SM] Not SR/Server1.vmx|Red Hat Enterprise Linux 3.2 (32-bit)
Server3|poweredOn|268401|[Z0109-XXX-PFCHT2-VMS-R001SM] Not SR or SFCHT1/Server1.vmx|Solaris 3.2
this one removing the duplicate host and keeping the host which has both "DR,H1". Need to know will there any bug using this filter for large file will it remove the host which "DR,H1" and keep only the host which has "H1"