{
    "version": "https:\/\/jsonfeed.org\/version\/1.1",
    "title": "Blog — George Mishurovsky: posts tagged jq",
    "_rss_description": "A blog by George Mishurovsky — a senior software engineer with a medical degree. Drawing from both engineering and scientific thinking, he explores software, architecture, design, psychology, and product thinking.",
    "_rss_language": "en",
    "_itunes_email": "george@mishurovsky.com",
    "_itunes_categories_xml": "",
    "_itunes_image": "https:\/\/mishurovsky.com\/blog\/pictures\/userpic\/userpic-square@2x.jpg?1753619610",
    "_itunes_explicit": "no",
    "home_page_url": "https:\/\/mishurovsky.com\/blog\/?go=tags\/jq\/",
    "feed_url": "https:\/\/mishurovsky.com\/blog\/?go=tags%2Fjq%2Fjson%2F",
    "icon": "https:\/\/mishurovsky.com\/blog\/pictures\/userpic\/userpic@2x.jpg?1753619610",
    "authors": [
        {
            "name": "George Mishurovsky",
            "url": "https:\/\/mishurovsky.com\/blog\/",
            "avatar": "https:\/\/mishurovsky.com\/blog\/pictures\/userpic\/userpic@2x.jpg?1753619610"
        }
    ],
    "items": [
        {
            "id": "50",
            "url": "https:\/\/mishurovsky.com\/blog\/?go=all\/jq-is-wonderful\/",
            "title": "<span class=\"inline-code\">jq<\/span> is Wonderful!",
            "content_html": "<div class=\"e2-text-picture\">\n<img src=\"https:\/\/mishurovsky.com\/blog\/pictures\/jq-is-wonderful@2x.jpg\" width=\"924\" height=\"327\" alt=\"\" \/>\n<\/div>\n<p>Linux is a brilliant OS — because it has a great set of tools to work with text files! Today I’ve tried to use <span class=\"inline-code\">jq<\/span> to come up with a little wonder I find worth sharing. Might be it will make your life simpler too.<\/p>\n<p>Suppose you have a <span class=\"inline-code\">chat-export.json<\/span> with your monthly spendings mixed with other messages like this:<\/p>\n<div class=\"e2-code-block\" data-language=\"json\"><div class=\"e2-code-header\"><span class=\"e2-code-language\">JSON<\/span><button class=\"e2-code-copy\" type=\"button\" aria-label=\"Copy code to clipboard\" data-copy-text=\"Copy\" data-copied-text=\"Copied!\" data-failed-text=\"Failed\"><span class=\"e2-svgi\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 16 16\"><mask id=\"cutout\"><rect width=\"100%\" height=\"100%\" fill=\"white\"\/><rect x=\"1.75\" y=\"5.25\" width=\"9\" height=\"9\" stroke-width=\"1.33\" rx=\"1\" fill=\"black\" stroke=\"black\"\/><\/mask><rect x=\"5.25\" y=\"1.75\" width=\"9\" height=\"9\" rx=\"1\" stroke-width=\"1.33\" fill=\"none\" mask=\"url(#cutout)\"\/><rect x=\"1.75\" y=\"5.25\" width=\"9\" height=\"9\" rx=\"1\" stroke-width=\"1.33\" fill=\"none\"\/><\/svg>\r\n<\/span>Copy<\/button><\/div><pre><code class=\"hljs language-json\">[\n  {\n    &quot;id&quot;: 139,\n    &quot;message&quot;: &quot;18 pizza in Pizza World&quot;,\n    &quot;chat&quot;: {\n      &quot;id&quot;: 123,\n    },\n    &quot;date&quot;: &quot;2026-02-26 10:15:00+00:00&quot;\n    \/\/ ...30 fields more\n  },\n  {\n    &quot;id&quot;: 140,\n    &quot;message&quot;: &quot;120 bills&quot;,\n    &quot;chat&quot;: {\n      &quot;id&quot;: 123,\n    },\n    &quot;date&quot;: &quot;2026-03-02 14:30:00+00:00&quot;\n  },\n  {\n    &quot;id&quot;: 141,\n    &quot;message&quot;: &quot;Some message from another chat&quot;,\n    &quot;chat&quot;: {\n      &quot;id&quot;: 140,\n    },\n    &quot;date&quot;: &quot;2026-03-02 19:20:00+00:00&quot;\n  },\n  {\n    &quot;id&quot;: 142,\n    &quot;message&quot;: &quot;3.5 coffee in Cream&quot;,\n    &quot;chat&quot;: {\n      &quot;id&quot;: 123,\n    },\n    &quot;date&quot;: &quot;2026-03-08 08:45:00+00:00&quot;\n  },\n  {\n    &quot;id&quot;: 143,\n    &quot;message&quot;: &quot;Another unrelated message&quot;,\n    &quot;chat&quot;: {\n      &quot;id&quot;: 156,\n    },\n    &quot;date&quot;: &quot;2026-03-11 12:05:00+00:00&quot;\n  },\n  \/\/ ...1000 entries more\n]<\/code><\/pre><\/div><p>How can you calculate your spendings in March *fast*? <span class=\"inline-code\">jq<\/span> to the rescue!<\/p>\n<div class=\"e2-code-block\" data-language=\"sh\"><div class=\"e2-code-header\"><span class=\"e2-code-language\">Shell<\/span><button class=\"e2-code-copy\" type=\"button\" aria-label=\"Copy code to clipboard\" data-copy-text=\"Copy\" data-copied-text=\"Copied!\" data-failed-text=\"Failed\"><span class=\"e2-svgi\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 16 16\"><mask id=\"cutout\"><rect width=\"100%\" height=\"100%\" fill=\"white\"\/><rect x=\"1.75\" y=\"5.25\" width=\"9\" height=\"9\" stroke-width=\"1.33\" rx=\"1\" fill=\"black\" stroke=\"black\"\/><\/mask><rect x=\"5.25\" y=\"1.75\" width=\"9\" height=\"9\" rx=\"1\" stroke-width=\"1.33\" fill=\"none\" mask=\"url(#cutout)\"\/><rect x=\"1.75\" y=\"5.25\" width=\"9\" height=\"9\" rx=\"1\" stroke-width=\"1.33\" fill=\"none\"\/><\/svg>\r\n<\/span>Copy<\/button><\/div><pre><code class=\"hljs language-sh\">jq &#039;[ .[]                       # iterate over array items\n  | select(.chat.id == 123)     # filter the ones from budget chat\n  | select(.date | startswith(&quot;2026-03&quot;)) # filter the ones from March\n  | .message                    # extract message text\n  | gsub(&quot;[^0-9.]&quot;; &quot;&quot;)         # leave only numeric symbols and dots\n  | tonumber                    # convert text to numbers\n] | add&#039; chat-export.json       # get the sum!<\/code><\/pre><\/div><p>Or as a one-liner:<\/p>\n<div class=\"e2-code-block\" data-language=\"shell\" data-long><div class=\"e2-code-header\"><span class=\"e2-code-language\">Shell<\/span><button class=\"e2-code-copy\" type=\"button\" aria-label=\"Copy code to clipboard\" data-copy-text=\"Copy\" data-copied-text=\"Copied!\" data-failed-text=\"Failed\"><span class=\"e2-svgi\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 16 16\"><mask id=\"cutout\"><rect width=\"100%\" height=\"100%\" fill=\"white\"\/><rect x=\"1.75\" y=\"5.25\" width=\"9\" height=\"9\" stroke-width=\"1.33\" rx=\"1\" fill=\"black\" stroke=\"black\"\/><\/mask><rect x=\"5.25\" y=\"1.75\" width=\"9\" height=\"9\" rx=\"1\" stroke-width=\"1.33\" fill=\"none\" mask=\"url(#cutout)\"\/><rect x=\"1.75\" y=\"5.25\" width=\"9\" height=\"9\" rx=\"1\" stroke-width=\"1.33\" fill=\"none\"\/><\/svg>\r\n<\/span>Copy<\/button><\/div><pre><code class=\"hljs language-shell\">jq &#039;[ .[] | select(.chat.id == 123) | select(.date | startswith(&quot;2026-03&quot;)) | .message | gsub(&quot;[^0-9.]&quot;; &quot;&quot;) | tonumber ] | add&#039; chat-export.json<\/code><\/pre><\/div><p>As short as it can get, clear, easy to use — and no software involved apart from utilities that come with the system. Shiny! ✨<\/p>\n",
            "date_published": "2026-03-30T11:05:29+02:00",
            "date_modified": "2026-03-30T11:05:16+02:00",
            "tags": [
                "data analytics",
                "jq",
                "linux",
                "shell"
            ],
            "image": "https:\/\/mishurovsky.com\/blog\/pictures\/jq-is-wonderful@2x.jpg",
            "_date_published_rfc2822": "Mon, 30 Mar 2026 11:05:29 +0200",
            "_rss_guid_is_permalink": "false",
            "_rss_guid": "50",
            "_rss_enclosures": [],
            "_e2_data": {
                "is_favourite": false,
                "links_required": [
                    "highlight\/highlight.js",
                    "highlight\/highlight.css"
                ],
                "og_images": [
                    "https:\/\/mishurovsky.com\/blog\/pictures\/jq-is-wonderful@2x.jpg"
                ]
            }
        }
    ],
    "_e2_version": 4134,
    "_e2_ua_string": "Aegea 11.3 (v4134e)"
}