Json file sample (test1.json) :
{
"entries": [
{
"duration": 478,
"id": "uCPPyitzI",
"title": "Why | TV",
"description": null,
"uploader": null,
"view_count": null,
"ie_key": "Youtube",
"url": "uCPPyitzI",
"_type": "url_transparent"
},
{
"duration": 245,
"id": "F9ClW8Dv0",
"title": "Kejrixxxx | TV",
"description": null,
"uploader": null,
"view_count": null,
"ie_key": "Youtube",
"url": "F9ClW8Dv0",
"_type": "url_transparent"
},
{
"duration": 990,
"id": "JchBXwZ8o",
"title": "Battle Of xxxx: | Dr. cccccc | TV",
"description": null,
"uploader": null,
"view_count": null,
"ie_key": "Youtube",
"url": "JchBXwZ8o",
"_type": "url_transparent"
},
{
"duration": 1178,
"id": "4x9dWcG2c",
"title": "Dirty Politics | Dr. xxxxx | TV",
"description": null,
"uploader": null,
"view_count": null,
"ie_key": "Youtube",
"url": "4x9dWcd2c",
"_type": "url_transparent"
}
],
"uploader_id": "xxxx",
"webpage_url": "https://www.youtube.com/playlist?list=xxx",
"title": ".aabbcc",
"extractor": "xxx:xxx",
"uploader": "xxxxxx",
"uploader_url": "https://www.youtube.com/channel/xxxx",
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"extractor_key": "xxxxx",
"webpage_url_basename": "xxxxxx",
"_type": "playlist"
}
The following command works fine in Linux:
cat test1.json | jq -r '.entries | map(.id +" | "+ .title) | join("\n")'
As per jq documentations :
When using the Windows command shell (cmd.exe) it's best to use double quotes around your jq program when given on the command-line (instead of the -f program-file option), but then double-quotes in the jq program need backslash escaping.
So I modified the command to for cmd.exe (Windows 10):
cat test1.json | jq -r ".[] | map(.id +\" | \" + .title) | join(\" \n \")"
But I keep getting the following error :
'\" + .title) | join(\"' is not recognized as an internal or external command, operable program or batch file.
What am I doing wrong? Please help.