Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 error

    Default value: ignore

    Possible values:

    • ignore: Do nothing with the error
    • panic: Exit the process on the first error
    • stderr: Output the errors to stderr
    • stdout: 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 the stringify 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 book
    • selection: Additional help about the selection
    • functions: Additional help about the available functions
    • basic: Additional help about the basic functions group
    • flow: Additional help about the flow functions group
    • collection: Additional help about the collection functions group
    • types: Additional help about the types functions group
    • check_types: Additional help about the check_types functions group
    • cast: Additional help about the cast functions group
    • list: Additional help about the list functions group
    • list_producers: Additional help about the list_producers functions group
    • list_manipluations: Additional help about the list_manipluations functions group
    • list_functional: Additional help about the list_functional functions group
    • list_folding: Additional help about the list_folding functions group
    • object: Additional help about the object functions group
    • object_to_list: Additional help about the object_to_list functions group
    • sort_objects: Additional help about the sort_objects functions group
    • manipulate_object: Additional help about the manipulate_object functions group
    • functional_object: Additional help about the functional_object functions group
    • number: Additional help about the number functions group
    • string: Additional help about the string functions group
    • parse_and_stringify: Additional help about the parse_and_stringify functions group
    • regex: Additional help about the regex functions group
    • boolean: Additional help about the boolean functions group
    • compare: Additional help about the compare functions group
    • logical: Additional help about the logical functions group
    • time: Additional help about the time functions group
    • variables: Additional help about the variables functions group
    • process: Additional help about the process functions group
    • nas: Additional help about the nas functions group
    • nas_arithmetic: Additional help about the nas_arithmetic functions group
    • nas_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 array

    Use 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 output

    Default value: json

    Possible values:

    • json: pretty JSON output
    • csv: CSV file format. This must have selection and can not be a produce of group by as we need to know the columns
    • text: 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 style

    Default value: one-line

    Possible values:

    • one-line: One line JSON
    • concise: 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.