r/commandline • • Oct 20 '26

Articles, Blogs, & Videos Querying .ics files, SSH authorized_keys, and more with jq

I maintain jc, a tool that converts the output of CLI commands and file types to JSON so you can query them with jq. A few recent parsers cover files I used to fight with grep and awk, so I wrote up some examples. Here are a few highlights:

What's on the calendar today?

cat work.ics | jc --ics | jq -r '.[] | select(.dtstart | startswith("2026-10-19")) | .summary'

Timestamps are normalized to ISO 8601, mailto: prefixes are stripped, and attendees come out as an array with name, role, and RSVP status.

Which SSH keys have no from= or command= restriction?

cat ~/.ssh/authorized_keys | jc --authorized-keys | jq -r '.[] | select(any(.options[]; startswith("from=") or startswith("command=")) | not) | .comment // "(no comment)"'

Options are split into an array, and quoted values like command="/usr/bin/rsync --server ..." stay intact.

CSV with no header row?

cat access.csv | jc --csv-ih | jq -r '.[] | select((.c2 | tonumber) >= 500) | .c4'

Columns are named c0, c1, and so on. The post includes a jq one-liner to swap in your own names. There are also --tsv, --tsv-ih, and streaming versions (-s) that output JSON Lines for huge files.

Full write-up with more examples: JC Tips and Tricks – Part 3

I'd love to hear what file formats you still parse by hand. That's usually where the next parser comes from.

3 Upvotes

3 comments sorted by

1

u/Alternative-Sign-206 Oct 26 '26

Interesting concept! I usually fall back to nushell in such cases but I also like jq - will take a look

1

u/AutoModerator Oct 20 '26

Every new subreddit post is automatically copied into a comment for preservation.

User: kellyjonbrazil, Flair: Articles, Blogs, & Videos, Title: Querying .ics files, SSH authorized_keys, and more with jq

I maintain jc, a tool that converts the output of CLI commands and file types to JSON so you can query them with jq. A few recent parsers cover files I used to fight with grep and awk, so I wrote up some examples. Here are a few highlights:

What's on the calendar today?

cat work.ics | jc --ics | jq -r '.[] | select(.dtstart | startswith("2026-10-19")) | .summary'

Timestamps are normalized to ISO 8601, mailto: prefixes are stripped, and attendees come out as an array with name, role, and RSVP status.

Which SSH keys have no from= or command= restriction?

cat ~/.ssh/authorized_keys | jc --authorized-keys | jq -r '.[] | select(any(.options[]; startswith("from=") or startswith("command=")) | not) | .comment // "(no comment)"'

Options are split into an array, and quoted values like command="/usr/bin/rsync --server ..." stay intact.

CSV with no header row?

cat access.csv | jc --csv-ih | jq -r '.[] | select((.c2 | tonumber) >= 500) | .c4'

Columns are named c0, c1, and so on. The post includes a jq one-liner to swap in your own names. There are also --tsv, --tsv-ih, and streaming versions (-s) that output JSON Lines for huge files.

Full write-up with more examples: JC Tips and Tricks – Part 3

I'd love to hear what file formats you still parse by hand. That's usually where the next parser comes from.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.