Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 657

How to filter jCal with jq?

$
0
0

I have a jCal JSON array which I'd like to filter with jq. JSON arrays are somewhat new to me and I have been banging my head to the wall on this for hours...

The file looks like this:

["vcalendar",  [    ["calscale",      {},"text","GREGORIAN"    ],    ["version",      {},"text","2.0"    ],    ["prodid",      {},"text","-//SabreDAV//SabreDAV//EN"    ],    ["x-wr-calname",      {},"unknown","Call log private"    ],    ["x-apple-calendar-color",      {},"unknown","#ffaa00"    ],    ["refresh-interval",      {},"duration","PT4H"    ],    ["x-published-ttl",      {},"unknown","PT4H"    ]  ],  [    ["vevent",      [        ["dtstamp",          {},"date-time","2015-04-05T16:42:10Z"        ],        ["created",          {},"date-time","2015-02-18T16:44:04Z"        ],        ["uid",          {},"text","9b23142b-8d86-3e17-2f44-2bed65b2e471"        ],        ["last-modified",          {},"date-time","2015-04-05T16:42:10Z"        ],        ["description",          {},"text","Phone call to +49xxxxxxxxxx lasted for 0 seconds."        ],        ["summary",          {},"text","Outgoing: +49xxxxxxx"        ],        ["dtstart",          {},"date-time","2015-02-18T10:58:12Z"        ],        ["dtend",          {},"date-time","2015-02-18T10:58:44Z"        ],        ["transp",          {},"text","OPAQUE"        ]      ],      []    ],    ["vevent",      [        ["dtstamp",          {},"date-time","2015-04-05T16:42:10Z"        ],        ["created",          {},"date-time","2015-01-09T19:12:05Z"        ],        ["uid",          {},"text","c337e092-a012-5f5a-497f-932fbc6159e5"        ],        ["last-modified",          {},"date-time","2015-04-05T16:42:10Z"        ],        ["description",          {},"text","Phone call to +1xxxxxxxxxx lasted for 39 seconds."        ],        ["summary",          {},"text","Outgoing: +1xxxxxxxxxx"        ],        ["dtstart",          {},"date-time","2015-01-09T17:23:16Z"        ],        ["dtend",          {},"date-time","2015-01-09T17:24:19Z"        ],        ["transp",          {},"text","OPAQUE"        ]      ],      []    ],  ]]

I would like to filter out dtstart, dtend, the target phone number and the connection duration from the description for each vevent which was created e.g. in January 2019 ("2019-01.*") and output them as a CSV.


Viewing all articles
Browse latest Browse all 657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>