<?xml version="1.0" encoding="utf-8"?> 
<rss version="2.0"
  xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
  xmlns:atom="http://www.w3.org/2005/Atom">

<channel>

<title>Blog — George Mishurovsky: posts tagged jq</title>
<link>https://mishurovsky.com/blog/?go=tags/jq/</link>
<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.</description>
<author></author>
<language>en</language>
<generator>Aegea 11.3 (v4134e)</generator>

<itunes:owner>
<itunes:name></itunes:name>
<itunes:email>george@mishurovsky.com</itunes:email>
</itunes:owner>
<itunes:subtitle>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.</itunes:subtitle>
<itunes:image href="https://mishurovsky.com/blog/pictures/userpic/userpic-square@2x.jpg?1753619610" />
<itunes:explicit>no</itunes:explicit>

<item>
<title>&lt;span class="inline-code"&gt;jq&lt;/span&gt; is Wonderful!</title>
<guid isPermaLink="false">50</guid>
<link>https://mishurovsky.com/blog/?go=all/jq-is-wonderful/</link>
<pubDate>Mon, 30 Mar 2026 11:05:29 +0200</pubDate>
<author></author>
<comments>https://mishurovsky.com/blog/?go=all/jq-is-wonderful/</comments>
<description>
&lt;div class="e2-text-picture"&gt;
&lt;img src="https://mishurovsky.com/blog/pictures/jq-is-wonderful@2x.jpg" width="924" height="327" alt="" /&gt;
&lt;/div&gt;
&lt;p&gt;Linux is a brilliant OS — because it has a great set of tools to work with text files! Today I’ve tried to use &lt;span class="inline-code"&gt;jq&lt;/span&gt; to come up with a little wonder I find worth sharing. Might be it will make your life simpler too.&lt;/p&gt;
&lt;p&gt;Suppose you have a &lt;span class="inline-code"&gt;chat-export.json&lt;/span&gt; with your monthly spendings mixed with other messages like this:&lt;/p&gt;
&lt;div class="e2-code-block" data-language="json"&gt;&lt;div class="e2-code-header"&gt;&lt;span class="e2-code-language"&gt;JSON&lt;/span&gt;&lt;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"&gt;&lt;span class="e2-svgi"&gt;&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"&gt;&lt;mask id="cutout"&gt;&lt;rect width="100%" height="100%" fill="white"/&gt;&lt;rect x="1.75" y="5.25" width="9" height="9" stroke-width="1.33" rx="1" fill="black" stroke="black"/&gt;&lt;/mask&gt;&lt;rect x="5.25" y="1.75" width="9" height="9" rx="1" stroke-width="1.33" fill="none" mask="url(#cutout)"/&gt;&lt;rect x="1.75" y="5.25" width="9" height="9" rx="1" stroke-width="1.33" fill="none"/&gt;&lt;/svg&gt;
&lt;/span&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre&gt;&lt;code class="hljs language-json"&gt;[
  {
    &amp;quot;id&amp;quot;: 139,
    &amp;quot;message&amp;quot;: &amp;quot;18 pizza in Pizza World&amp;quot;,
    &amp;quot;chat&amp;quot;: {
      &amp;quot;id&amp;quot;: 123,
    },
    &amp;quot;date&amp;quot;: &amp;quot;2026-02-26 10:15:00+00:00&amp;quot;
    // ...30 fields more
  },
  {
    &amp;quot;id&amp;quot;: 140,
    &amp;quot;message&amp;quot;: &amp;quot;120 bills&amp;quot;,
    &amp;quot;chat&amp;quot;: {
      &amp;quot;id&amp;quot;: 123,
    },
    &amp;quot;date&amp;quot;: &amp;quot;2026-03-02 14:30:00+00:00&amp;quot;
  },
  {
    &amp;quot;id&amp;quot;: 141,
    &amp;quot;message&amp;quot;: &amp;quot;Some message from another chat&amp;quot;,
    &amp;quot;chat&amp;quot;: {
      &amp;quot;id&amp;quot;: 140,
    },
    &amp;quot;date&amp;quot;: &amp;quot;2026-03-02 19:20:00+00:00&amp;quot;
  },
  {
    &amp;quot;id&amp;quot;: 142,
    &amp;quot;message&amp;quot;: &amp;quot;3.5 coffee in Cream&amp;quot;,
    &amp;quot;chat&amp;quot;: {
      &amp;quot;id&amp;quot;: 123,
    },
    &amp;quot;date&amp;quot;: &amp;quot;2026-03-08 08:45:00+00:00&amp;quot;
  },
  {
    &amp;quot;id&amp;quot;: 143,
    &amp;quot;message&amp;quot;: &amp;quot;Another unrelated message&amp;quot;,
    &amp;quot;chat&amp;quot;: {
      &amp;quot;id&amp;quot;: 156,
    },
    &amp;quot;date&amp;quot;: &amp;quot;2026-03-11 12:05:00+00:00&amp;quot;
  },
  // ...1000 entries more
]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;How can you calculate your spendings in March *fast*? &lt;span class="inline-code"&gt;jq&lt;/span&gt; to the rescue!&lt;/p&gt;
&lt;div class="e2-code-block" data-language="sh"&gt;&lt;div class="e2-code-header"&gt;&lt;span class="e2-code-language"&gt;Shell&lt;/span&gt;&lt;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"&gt;&lt;span class="e2-svgi"&gt;&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"&gt;&lt;mask id="cutout"&gt;&lt;rect width="100%" height="100%" fill="white"/&gt;&lt;rect x="1.75" y="5.25" width="9" height="9" stroke-width="1.33" rx="1" fill="black" stroke="black"/&gt;&lt;/mask&gt;&lt;rect x="5.25" y="1.75" width="9" height="9" rx="1" stroke-width="1.33" fill="none" mask="url(#cutout)"/&gt;&lt;rect x="1.75" y="5.25" width="9" height="9" rx="1" stroke-width="1.33" fill="none"/&gt;&lt;/svg&gt;
&lt;/span&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre&gt;&lt;code class="hljs language-sh"&gt;jq &amp;#039;[ .[]                       # iterate over array items
  | select(.chat.id == 123)     # filter the ones from budget chat
  | select(.date | startswith(&amp;quot;2026-03&amp;quot;)) # filter the ones from March
  | .message                    # extract message text
  | gsub(&amp;quot;[^0-9.]&amp;quot;; &amp;quot;&amp;quot;)         # leave only numeric symbols and dots
  | tonumber                    # convert text to numbers
] | add&amp;#039; chat-export.json       # get the sum!&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Or as a one-liner:&lt;/p&gt;
&lt;div class="e2-code-block" data-language="shell" data-long&gt;&lt;div class="e2-code-header"&gt;&lt;span class="e2-code-language"&gt;Shell&lt;/span&gt;&lt;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"&gt;&lt;span class="e2-svgi"&gt;&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"&gt;&lt;mask id="cutout"&gt;&lt;rect width="100%" height="100%" fill="white"/&gt;&lt;rect x="1.75" y="5.25" width="9" height="9" stroke-width="1.33" rx="1" fill="black" stroke="black"/&gt;&lt;/mask&gt;&lt;rect x="5.25" y="1.75" width="9" height="9" rx="1" stroke-width="1.33" fill="none" mask="url(#cutout)"/&gt;&lt;rect x="1.75" y="5.25" width="9" height="9" rx="1" stroke-width="1.33" fill="none"/&gt;&lt;/svg&gt;
&lt;/span&gt;Copy&lt;/button&gt;&lt;/div&gt;&lt;pre&gt;&lt;code class="hljs language-shell"&gt;jq &amp;#039;[ .[] | select(.chat.id == 123) | select(.date | startswith(&amp;quot;2026-03&amp;quot;)) | .message | gsub(&amp;quot;[^0-9.]&amp;quot;; &amp;quot;&amp;quot;) | tonumber ] | add&amp;#039; chat-export.json&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As short as it can get, clear, easy to use — and no software involved apart from utilities that come with the system. Shiny! ✨&lt;/p&gt;
</description>
</item>


</channel>
</rss>