I am searching a file
and not able to escape a space if $i
has a space in the name. I tried escaping it with a \
and also trying to add it to allow for spaces in the search. Neither are correct as the first awk
only outputs path and the second awk
doesn't run. Thank you :).
first awk
awk -F"[]\":{}, ]*" '
{for (i=1; i<NF; i++) {if ($i =="path") print $(i+1)
if ($i =="Sample \ Name") print $(i+1)
}
}
' file
second awk
awk -F"[]\s":{}, ]*" '
{for (i=1; i<NF; i++) {if ($i =="path") print $(i+1)
if ($i =="Sample \ Name") print $(i+1)
}
}
' file
file
"path": "/results/analysis/output/Home/Auto_user_S5-00580-4-Medexome_65_028/plugin_out/FileExporter_out.52", "Sample Name": "MEV37",
desired output
/results/analysis/output/Home/Auto_user_S5-00580-4-Medexome_65_028/plugin_out/FileExporter_out.52
MEV37