Line:

"aaa bb {"":{}} nnn nnn" 

need to pull out:

 {"":{}} 

Closed due to the fact that the issue is too general for the participants Wiktor Stribiżew , 0xdb , Enikeyschik , nörbörnën , iluxa1810 January 18 at 7:21

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

1 answer 1

 sub=$(echo "${result}"|awk '/{/,/}/');echo $sub 
  • The answer has nothing to do with the question marks. if necessary in a language understood by the bash interpreter, then something like this: $ s="aaa bb {\"\":{}} nnn nnn"; s1=${s#*bb}; sub=${s1%%nnn*} $ s="aaa bb {\"\":{}} nnn nnn"; s1=${s#*bb}; sub=${s1%%nnn*} $ s="aaa bb {\"\":{}} nnn nnn"; s1=${s#*bb}; sub=${s1%%nnn*} - aleksandr barakin pm