Q:

number in string to find char in that string UNIX

I have a string that contains a word and a number, like this:
"6 ovenbread"

How can I read the number (let's call it i) and find the ith character of the word?
It seems that s/([0-9]) (.){\1}/\2/ doesn't work.

A:

I think awk is easier, it has substr function, allows you to pick the n-th letter.
awk '{print substr($2,$1,1)}'

with your data:
kent$ echo "6 ovenbread"|awk '{print substr($2,$1,1)}'
r

