I got this input and I try to extract "out_of_stock". I want to extract the value between "code":" and ","days_. Consider "{"id":5,"text":"Stoc epuizat","code":"out_of_stock","days_estimation":0" as any other string ignore the json appearace.. Also I would like to assign it to a variable in bash
$ cat input_test.html
availability: {"id":5,"text":"Stoc epuizat","code":"out_of_stock","days_estimation":0
$ sed -n "s/.*code\":\"(.*)\",\"days.*/\1/p" input_test.html > output_test.html
sed: -e expression #1, char 29: invalid reference \1 on `s' command's RHS