I have a text file and I\'m trying to replace a specific character (.) in the first column to another character (-). Every field is delimited by comma. Some of the lines hav
This might work for you:
awk -F, -vOFS=, '{for(n=1;n<=3;n++)sub(/\./,"-",$1)}1' file abc-def-ghi-qqq.www,123.4561.789,ABC,DEF,GHI abc-def-ghq-qqq.www,124.4562.789,ABC,DEF,GHI abc-def-ghw-qqq.www,125.4563.789,ABC,DEF,GHI abc-def-ghe-qqq.www,126.4564.789,,, abc-def-ghr-qqq.www,127.4565.789,,,