Combo for text

Hello all,
i need to extract a part from an API output. Imagine this is the output :

"result":[]
"result":["alternative":["transcript":"hello my name is Mike"
"confidence":0.98091763
"transcript":"Hello My Name Is Mud"

i need to use only the "hello my name is Mike" in the second line, without " "

how can i do that?
Thanks in advance

Kind Regards and congrats for the great forum.

Hello Board27,

If your Input_file's 2nd line is the one which you want to always get then following may help you in same.

awk 'NR==2{gsub(/.*:\"/,X,$0);sub(/\"/,X,$0);print}'   Input_file
OR
awk -F"\"" 'NR==2{;print $(NF-1)}'   Input_file
OR
awk 'NR==2{match($0,/:\".*\"$/);print substr($0,RSTART+2,RLENGTH-3)}'   Input_file

Output will be as follows.

hello my name is Mike

Thanks,
R. Singh

1 Like

thanks a lot!