Searching for exact match in a string ??

Hi

I have a string of the form XY_X1998.10.500.
I want to check in a script that the middle part is always 10. How to achieve this?

e.g the input can be XY_X1998.20.500 OR XY_X1998.50.500
OR XY_X1998.10.500.

I have to print Yes everytime the middle value is 10 and NO when the middle value is other than 10.

Please help.

Try...

$ string="XY_X1998.10.500"
$ case $string in *.10.*) echo yes;; *) echo no;; esac
yes
$
read val
echo $val | awk -F"." '{
if($2==10)
print "YES"
else
print "NO"
}'