replace a field in a CSV file

Hello all,

I've a CSV file and need to replace 5th field if its value is "X".

The exact requirement is to replace 5th field (column) with "Y" if
a. it's value is "X" AND
b. the line must start with ABC string

i guess this can be done with awk. Pl help.

For security reasons, the actual file format and contents are changed.

Thanks
Prvn

awk '$1 ~ /^ABC/ && $5=="X"{$5="Y"}1' file

Thank you danmero,

It worked great.

I just had to add -vOFS="," to get the output with commas.

Thanks!