Replace , (comma) with space

Hi, what is the better way to replace the , (comma) with a space char? Example:

STRING=dir1,dir2,dir3

to

STRING=dir1 dir2 dir3

And.. how to find if in the string there is a comma?

Thanks :slight_smile:

look into 'man tr'

TEST=`echo "dir1,dir2,dir3" | tr ',' ' '`
echo $TEST

Ok, thanks so much. And for check if the string contains a comma? Bye

#!/bin/ksh

a='1,2,3,4'
#a='123 4'

[[ ${a} == @(*,*) ]] && echo 'WITH' || echo 'WITHout'

Ooops.. I use /bin/sh. I try to convert the command but I have problem with ()..

#!/bin/sh

a='1,2,3,4'
#a='123 4'

if [ `echo ${a} | grep -c ','` -gt 0 ] ; then
   echo 'WITH'
else
   echo 'WITHout'
fi;

Perfect, thanks so much. :slight_smile: