Return path of specific tag using awk

The below awk is used with the attached index.html and matches the specific user id in the sub portion with path of /rundb/api/v1/plugin/49/ . The command does run but the output is blank. Something changed in the file structure as it used to work.

So using the first line in the output:

"plugin": "/rundb/api/v1/plugin/49/" is found and /results/analysis/output/Home/Auto_user_S5-00580-11-Medexome_74_042/plugin_out/FileExporter_out.81" is the path

Thank you :).

awk

awk -F'"[]},:]* *"*' -v RS='{' '
function pA(arg, string) {
	string = arg
	sub(/_R_.*/, "", string)
	return string
}
{for(i = 2; i < NF - 1; i++) {
     if($i == "path") {
     if($(i + 2) == "plugin" &&
        $(i + 3) == "/rundb/api/v1/plugin/49/") {
          found = 1
          print (u = $(i+1))
          sub(/.*_user_/, "", u)
          sub(/_.*/, "", u)
          sub(/^/, "user_", u)
          i += 3
          }
            continue
          }
      	  }
}' index.html | sed '/_tn_/d'> testout

testout desired output

/results/analysis/output/Home/Auto_user_S5-00580-11-Medexome_74_042/plugin_out/FileExporter_out.81
/results/analysis/output/Home/Auto_user_S5-00580-10-Medexome_73_040/plugin_out/FileExporter_out.78
/results/analysis/output/Home/Auto_user_S5-00580-9-Medexome_70_038/plugin_out/FileExporter_out.70
/results/analysis/output/Home/Auto_user_S5-00580-8-Medexome_69_036/plugin_out/FileExporter_out.69
/results/analysis/output/Home/Auto_user_S5-00580-7-Medexome_68_034/plugin_out/FileExporter_out.68
/results/analysis/output/Home/Auto_user_S5-00580-6-Medexome_67_032/plugin_out/FileExporter_out.67

It was this line $(i + 3) == "/rundb/api/v1/plugin/49/") { that changed in the API . I had to update it to $(i + 5) == "FileExporter") { to get the desired results. Thank you :).

Hi cmccabe,
where function pa is being used.?