TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

To a Man with `Jq`, Everything Looks Like JSON

48 点作者 ishandotpage超过 1 年前

5 条评论

mdaniel超过 1 年前
heh, wait until one discovers that gojq &lt;<a href="https:&#x2F;&#x2F;github.com&#x2F;itchyny&#x2F;gojq#difference-to-jq">https:&#x2F;&#x2F;github.com&#x2F;itchyny&#x2F;gojq#difference-to-jq</a>&gt; accepts <i>yaml</i> input; so, if you happen to have a bunch of _almost_ structured data then some light sprinkling can turn it into yaml and then you&#x27;re back in the loving embrace of the jq transformation&#x2F;mutation language :heart:<p><pre><code> $ cat some-vendor-nonsense.txt product id: 5 price: 3.14 product id: 6 price: 6.66 $ sed &quot;s&#x2F;^&#x2F; &#x2F;; s&#x2F;^ product&#x2F;- product&#x2F;&quot; &lt; some-vendor-nonsense.txt \ | gojq --yaml-input .</code></pre>
评论 #38604821 未加载
评论 #38579020 未加载
评论 #38581660 未加载
rnemeth91超过 1 年前
If you&#x27;d like to use jq in any JetBrains IDE (e.g. IntelliJ), here&#x27;s a plugin for it: <a href="https:&#x2F;&#x2F;plugins.jetbrains.com&#x2F;plugin&#x2F;23360-jqexpress" rel="nofollow noreferrer">https:&#x2F;&#x2F;plugins.jetbrains.com&#x2F;plugin&#x2F;23360-jqexpress</a>
QuercusMax超过 1 年前
At some point in the last 25 years I learned &quot;perl -pi -e&quot; and &quot;for x in [whatever]; do [something] $x; done&quot; and I type those without thinking when I&#x27;m working in the shell. I haven&#x27;t written any perl in probably 12 years, but I still use it for file manipulation.
mpalmer超过 1 年前
jq has string interpolation too, so it can even get a little bit nicer:<p><pre><code> &quot;&lt;option value=\&quot;&#x2F;examples&#x2F;\(.)&#x2F;\&quot;&gt;\(.)&lt;&#x2F;option&gt;&quot;</code></pre>
评论 #38583315 未加载
sam0x17超过 1 年前
&gt; Back in the Bootstrap 3 days, there used to be a customizer.<p>There is still a quite good bootstrap customizer at bootstrap.build btw ;)