-
Notifications
You must be signed in to change notification settings - Fork 193
Open
Description
Below is the JSON output text from a command, trying to fetch FullName and FileVersionRaw where FullName not contains '\msvc\'
{
"windows_result.output": [
{
"FullName": "E:\\\\app\\\\client\\\\product\\\\client\\\\bin\\\\file.txt",
"Mode": "-a----",
"Target": [],
"VersionInfo": {
"FileVersionRaw": "19.0.0.0",
"ProductVersionRaw": "0.0.0.0"
}
},
{
"FullName": "E:\\\\app\\\\client\\\\product\\\\msvc\\\\vc10\\\\file.txt",
"Mode": "-a----",
"Target": [],
"VersionInfo": {
"FileVersionRaw": "19.0.0.0",
"ProductVersionRaw": "0.0.0.0"
}
}
]
}
Below code produces result as we search only for string '\\msvc' which starts with backslash
- name: Print result - Windows
debug:
msg: "{{ windows_result.output | to_json | from_json | json_query(client_path) }}"
vars:
client_path: "[? !contains(FullName,'\\msvc')].{FullName: FullName, FileVersionRaw: VersionInfo.FileVersionRaw}"
Result output:
"msg": [
{
"FileVersionRaw": "19.0.0.0",
"FullName": "E:\\\\app\\\\client\\\\product\\\\client\\\\bin\\\\file.txt"
}
]
However if string modified to '\\msvc\\' to search msvc between backslashes, \' at end considered as escape for single quote and throws error. Please help.
Metadata
Metadata
Assignees
Labels
No labels