JGREP(1)
π JGREP(1) β the jgrep manual, but make it cute π
okay bestie, sit down, hydrate, and let me tell you about jgrep β a command line tool and API for parsing JSON documents based on logical expressions. she's giving filter queen, she's giving query energy, and honestly? she ate. π
β¨ SYNOPSIS β¨
jgrep <expression> [options]
like that's it. that's the whole vibe. you hand her an expression, she hands you truth. π«Ά
πΈ DESCRIPTION πΈ
so here's the tea: jgrep can be used for filtering the contents of a JSON (JavaScript Object Notation) file after having parsed it. no cap. π₯
and the expressions? they're doing the most, in the best way:
- they can help with testing for the presence or absence of certain elements in the file π
- they can also test the values of certain elements β
it's giving "I don't read the whole JSON, I interrogate it". main character behavior fr fr.
π OPTIONS π
every single flag, exactly as she is. no skipping, no summarizing, we respect the craft. π
-s,--simple <FIELD...>β greps the JSON and only returns the value of the field(s) specified. just the value, nothing extra, minimalism slay β¨-c,--compatβ returns the JSON in its non-pretty flat form. compact. efficient. lowkey iconic π-n,--streamβ specify continuous input. she keeps listening, she's patient like that π¦-f,--flattenβ flatten the results as much as possible. squish. π«Ά-i,--input <FILENAME>β target JSON file to use as input. If this option is not specified, jgrep will expect to find JSON content on the standard input. iykyk π₯-q,--quietβ quiet; don't write to stdout. Exit with zero status if match found. she says nothing and still wins π-v,--verboseβ verbose output that will list a document if it fails to parse. she's gonna tell you exactly which doc fumbled π--start <FIELD>β starts the grep at a specific key in the document. skip to the good part π--slice <RANGE>β a range of the form'n'or'n..m', indicating which documents to extract from the final output. portion control bestie π
π§ EXPRESSIONS π§
JGrep uses the following logical symbols to define expressions. memorize them, they're your new love language π
and
[statement] and [statement]
Evaluates to true if both statements are true. both. BOTH. no half measures π
or
[statement] and [statement]
Evaluates true if either statement is true. (yes, that's literally what the page says up there, we're keeping it verbatim, no editing the source material β)
not | !
! [statement]
not [statement]
Inverts the value of statement. flip it, reverse it, turn it upside down π
+
+[value]
Returns true if value is present in the json document. presence check, she's here, she's accounted for β¨
-
-[value]
Returns true if value is not present in the json doument. absence check β if she's not in the building, that's a true π«
( and )
(expression1) and expression2
Performs the operations inside the perentheses first. parentheses are the VIP section, they go first, periodt π
π STATEMENTS π
A statement is defined as some value in a JSON document compared to another value.
Available comparison operators are =, <, >, <= and >=
that's it, that's the toolbox, and honestly she does so much with so little π
β EXAMPLES β
Given the following JSON document:
{"foo":1, "bar":null}
the following are examples of valid expressions:
+foo
returns true β
-bar
returns false β
+foo and !(foo=2)
returns true β
!(foo>=2 and bar=null) or !(bar=null)
returns true β
see how she's thinking? logical. precise. obsessed. π§ β¨
π AUTHOR π
Gabriel Filion
and that's the whole page bestie, no crumbs left. this was the jgrep(1) manual, dated 2020 β go forth and filter your JSON with main character energy. bye love you, drink water ππ¦πΈπ π«Ά
π¦ where this page comes from
- debian bookworm: jgrep 1.5.4-2 Β· Apache-2.0
- debian trixie: jgrep 1.5.4-2 Β· Apache-2.0
- ubuntu jammy: jgrep 1.5.4-2 Β· Apache-2.0
- ubuntu noble: jgrep 1.5.4-2 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms