I'm trying below
a = device.1.2
echo $a should print 1.2
Tried with sed 's/[a-z]//g' a
I'm trying below
a = device.1.2
echo $a should print 1.2
Tried with sed 's/[a-z]//g' a
First thing first please make sure your shell variable doesn't have space while assigning value to it, so have it like this: a="device.1.2". With your shown samples, could you please try following once.
Have it with parameter substitution way: Where we need not to use an external program to get the value.
echo "${a#*.}"
OR with sed: Since OP was trying sed so adding one sed solution here, this nice command was given by Benjamin see comments for same.
echo "$a" | sed 's/^[^.]*\.//'