awk - delimited output

Hi

I am looking for syntax in awk, where I am printing comma separated coulmns read from delimited file.

Say for e.g. awk -F":" '{print $1","$2","9}' fname

Instead of using "," withing print syntax,is there any way by which fields being printed will automatically get delimited by comma?

NOTE : Example mentioned above is just marginal subset of columns to be displayed.

Thanks in advace.

awk -F":" -v OFS=',' '{print $1, $2, 9}' fname
1 Like