In the below awk
I am trying to print expName
only if another tag planExecuted
is true
. In addition to the expName
I am also printing planShortID
. For some reason the word experiment
gets printed so I remove it with sed
. I have attached the complete index.html
as well as included a sample of it in file
. The awk
does run but the output is empty. I was following a code from @ Don Cragun but I am doing something wrong. Thank you
awk
awk -F'"[]},:]* *"*' -v RS='{' '
{for(i = 2; i < NF - 1; i++) {
if($i == "expName" &&
$(i + 2) == "planExecuted" &&
$(i + 3) == "true")
print $(i+1) RS $(i+43)
}
}' file | sed '/experiment/d' > out
file
{"meta": {"limit": 20, "next": "/rundb/api/v1/plannedexperimentdb/?offset=20&limit=20&format=json", "offset": 0, "previous": null, "total_count": 52}, "objects": [{"adapter": null, "applicationGroup": "/rundb/api/v1/applicationgroup/1/", "autoName": null, "categories": "", "childPlans": [], "controlSequencekitname": null, "cycles": null, "date": "2016-09-21T19:03:28.000079+00:00", "expName": "R_2016_09_21_14_01_15_user_S5-00580-9-Medexome", "experiment": "/rundb/api/v1/experiment/70/", "id": 78, "irworkflow": "", "isFavorite": false, "isPlanGroup": false, "isReusable": false, "isReverseRun": false, "isSystem": false, "isSystemDefault": false, "libkit": null, "libraryReadLength": 200, "metaData": {}, "pairedEndLibraryAdapterName": "", "parentPlan": null, "planDisplayedName": "Medexome", "planExecuted": true, "planExecutedDate": null, "planGUID": "00212eae-ba3d-4b1e-8496-cc1dbd9a9748", "planName": "Medexome", "planPGM": null, "planShortID": "RLNI0", "planStatus": "run", "preAnalysis": true, "project": "medexome_validation", "projects": ["medexome_validation"], "qcValues": [{"id": 208,
desired result
R_2016_09_21_14_01_15_user_S5-00580-9-Medexome
RLNI0