Command-Line Help for jawk
This document contains the help content for the jawk
command-line program.
Command Overview:
jawk
An AWK like toold for JSON input.
This tool should allow one to manipulate an input file that contains JSON values into CSV or JSON output. See more details in https://jawk.ykaplan.me/
Usage: jawk [OPTIONS] [FILES]...
Arguments:
-
<FILES>
— Input files.If omitted the standard in will be used. If any of the files is a directory, all it's files will be used.
Options:
-
--on-error <ON_ERROR>
— What to do on errorDefault value:
ignore
Possible values:
ignore
: Do nothing with the errorpanic
: Exit the process on the first errorstderr
: Output the errors to stderrstdout
: Output the errors to stdout
-
-c
,--choose <CHOOSE>
[alias:select
] — What to output.Can be multiple selection. The expected format is
<selection>[=name]
. If name is omitted, the selection will be the name. See selection additional help for available selections format.For example:
--select .name.first=First Name
-
-f
,--filter <FILTER>
[alias:where
] — Filter the output. The expected format is<selection>
.If the filter is not true, the input will ignored. See selection additional help for available selections format.
For example:
--filter=(or (= .name.first "John") (= .name.first "Jane"))
. -
-b
,--break-by <BREAK_BY>
[alias:split-by
] — Split the input by.The expected format is
<selection>
. If the output is not an array, the data will be ignored See selection additional help for available selections format. This will run before the filter.For example:
--split-by=.results
. -
-g
,--group-by <GROUP_BY>
[aliases:combine
,merge
] — Group the output by.Be careful, the grouping is done in memory. The expected format is
<selection>
. If the output is not a string, the data will be ignored. One can use thestringify
function if needed. See selection additional help for available selections format. Omitting the selection will produce a list instead of an object.For example:
--group-by=.name.first
. -
-s
,--sort-by <SORT_BY>
[alias:order-by
] — How to order the output. Allow muttiploe sorting.Be careful, the sorting is done in memory. The expected format is
<selection>[=DESC]
or<selection>[=ASC]
. If the directioon is omitted,ASC
is assumed. The order is null, false, true, strings, numbers, objects, arrays. See selection additional help for available selections format.For example:
--sort-by=.name.last --sort-by=.name.first
. -
-k
,--skip <SKIP>
— How many results to skip (if any)Default value:
0
-
-t
,--take <TAKE>
[alias:limit
] — Maximal number of result to process -
-a
,--additional-help <ADDITIONAL_HELP>
— Additional help.Display additional help. Use the function name to get additional help on a specific function.
Possible values:
book
: Open the bookselection
: Additional help about the selectionfunctions
: Additional help about the available functionsbasic
: Additional help about the basic functions groupflow
: Additional help about the flow functions groupcollection
: Additional help about the collection functions grouptypes
: Additional help about the types functions groupcheck_types
: Additional help about the check_types functions groupcast
: Additional help about the cast functions grouplist
: Additional help about the list functions grouplist_producers
: Additional help about the list_producers functions grouplist_manipluations
: Additional help about the list_manipluations functions grouplist_functional
: Additional help about the list_functional functions grouplist_folding
: Additional help about the list_folding functions groupobject
: Additional help about the object functions groupobject_to_list
: Additional help about the object_to_list functions groupsort_objects
: Additional help about the sort_objects functions groupmanipulate_object
: Additional help about the manipulate_object functions groupfunctional_object
: Additional help about the functional_object functions groupnumber
: Additional help about the number functions groupstring
: Additional help about the string functions groupparse_and_stringify
: Additional help about the parse_and_stringify functions groupregex
: Additional help about the regex functions groupboolean
: Additional help about the boolean functions groupcompare
: Additional help about the compare functions grouplogical
: Additional help about the logical functions grouptime
: Additional help about the time functions groupvariables
: Additional help about the variables functions groupprocess
: Additional help about the process functions groupnas
: Additional help about the nas functions groupnas_arithmetic
: Additional help about the nas_arithmetic functions groupnas_compare
: Additional help about the nas_compare functions group
-
-u
,--unique
— Avoid posting the same output more than once.Be careful, the data is kept in memory.
-
-e
,--set <SET>
— Predefine variables and macros.One can define multiple variables and macros. The expected format is
key=value
for variables or@key=value
for macros.For example:
--set one=1 --set pi=3.14 --set name="Name" --set @pirsquare=(* :pi . .)
. -
--regular-expression-cache-size <REGULAR_EXPRESSION_CACHE_SIZE>
— Regular expression cache size.Regular expression compilation can time time. If you have a few repeating complex regular expression, you can set a cache of compiled expressions, this will make sure that the often used regular expression are compiled only once. Omitting this setting will re-compile the regular expressions before any use (i.e. size 0).
Default value:
0
-
--only-objects-and-arrays
— Only accept objects and arrayUse this to ignore numbers, Booleans and nulls in the input stream and only treat objects and arrays (that is, as defined in RFC 4627).
-
-o
,--output-style <OUTPUT_STYLE>
— How to display the outputDefault value:
json
Possible values:
json
: pretty JSON outputcsv
: CSV file format. This must have selection and can not be a produce of group by as we need to know the columnstext
: Raw text output
-
-r
,--row-separator <ROW_SEPARATOR>
— Row separator.How to separate between each row. The default is new line, but one can use something like `--row_separator="---\n" to use yaml style separation.
Default value:
-
--style <STYLE>
— Json output styleDefault value:
one-line
Possible values:
one-line
: One line JSONconcise
: Concise JSON output (no unneeded white spaces)pretty
: Pretty JSON output
-
--utf8-strings
— Output string literal as UTF8 for JSON, (by default only ASCII will be used, and everything else will be escaped)Default value:
false
-
--items-separator <ITEMS_SEPARATOR>
— separate items by (for text output)Default value:
-
--string-prefix <STRING_PREFIX>
— What to add before a String value (for text output)Default value: ``
-
--string-postfix <STRING_POSTFIX>
— What to add after a String value (for text output)Default value: ``
-
--headers
— Include headers (for text output)Default value:
false
-
--escape-sequance <ESCAPE_SEQUANCE>
— Escape sequance. Can be set more than once. should be used with the escaped character followed by the excpaed sequance. For example,"\"
will set the"`` to be escaped by a
"` (for text output) -
--null-keyword <NULL_KEYWORD>
— How to display nulls values (for text output)Default value:
null
-
--true-keyword <TRUE_KEYWORD>
— How to display true values (for text output)Default value:
true
-
--false-keyword <FALSE_KEYWORD>
— How to display false values (for text output)Default value:
false
-
--missing-value-keyword <MISSING_VALUE_KEYWORD>
— How to display missing values (for text output)
This document was generated automatically by
clap-markdown
.