selective printing

hi all

from below text
"abcd,SYS_12345,xyz,PQR, ,"

I want to print only
"abcd,SYS,xyz,PQR, ,"

i.e. taking only first three 3 chars from 2 string of comma separated file

thanks

 
$ echo abcd,SYS_12345,xyz,PQR, , | nawk -F, 'BEGIN{OFS=","}{$2=substr($2,5,length($2));print}'                                                     
abcd,12345,xyz,PQR, ,

Or:

echo abcd,SYS_12345,xyz,PQR, , | sed 's/_[^,]*//'

Thanks a lot ... :slight_smile: it worked

nice work done by you.