number in string to find char in that string UNIX

前端 未结 2 2082
借酒劲吻你
借酒劲吻你 2021-01-26 06:57

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 fin

2条回答
  •  深忆病人
    2021-01-26 07:20

    No, you can't do that in sed, but it's easy enough in Awk.

    awk '{ print substr($2,$1,1) }' file
    

提交回复
热议问题