extracting a string between two quotes in bash

前端 未结 3 743
被撕碎了的回忆
被撕碎了的回忆 2021-01-19 07:00

I have example string like Test \"checkin_resumestorevisit - Online_V2.mt\" Run

and i want to extract the text between the two quotes in bash. I tried

3条回答
  •  终归单人心
    2021-01-19 07:30

    If you want to extract content between the first " and the last ":

    s='Test "checkin_resumestorevisit - Online_V2.mt" Run'
    s=${s#*'"'}; s=${s%'"'*}
    echo "$s"
    

提交回复
热议问题