You did not specify what x should be in sdX so one could as well assume that it might be any character:
$ echo echo ""dfs.datanode.data.dir" : "/rid/sdb/oo/hdfs/data,/rid/sdc/oo/hdfs/data,/rid/sdd/oo/hdfs/data,/rid/sde/oo/hdfs/data,/rid/sdf/oo/hdfs /data"," | grep -o 'sd.'
sdb
sdc
sdd
sde
sdf
A literal . means any character in regular expressions.
And in perl because you wanted that explicitly:
$ echo ""dfs.datanode.data.dir" : "/rid/sdb/oo/hdfs/data,/rid/sdc/oo/hdfs/data,/rid/sdd/oo/hdfs/data,/rid/sde/oo/hdfs/data,/rid/sdf/oo/hdfs/data"," | perl -nE 'say $& while /sd./g'
sdb
sdc
sdd
sde
sdf
printf '%s\n' sdb sdc sdd sde sdf. If you want a more general answer, please explain what you want, in general. Do you want to extract thesdgfrom/dev/sdg, or only after/rid/? What if the input containssd1,sd17, orsda17? How aboutopen("/dev/sd#"); would you wantsd#(i.e., including the next character aftersd, even if it’s not alphanumeric)? How about words like “disdain”, “wisdom”, “eavesdrop”, “transduce”, “jurisdiction”, “misdeed”, “Tuesday”, “Wednesday” and “Thursday” (which contain “sd”)? How about “freebsd” (which ends with “sd”)?