Actions Status MetaCPAN Release

NAME

greple -Mjq - greple module to search JSON data with jq

SYNOPSIS

greple -Mjq --glob JSON-DATA --IN label pattern

VERSION

Version 0.06

DESCRIPTION

This is an experimental module for App::Greple to search JSON formatted text using jq(1) as a backend.

Search top level json object which includes both Marvin and Zaphod somewhere in its text representation.

greple -Mjq 'Marvin Zaphod'

You can search object .commit.author.name includes Marvin like this:

greple -Mjq --IN .commit.author.name Marvin

Search first name field including Marvin under .commit:

greple -Mjq --IN .commit..name Marvin

Search any author.name field including Marvin:

greple -Mjq --IN author.name Marvin

Search name is Marvin and type is Robot or Android:

greple -Mjq --IN name Marvin --IN type 'Robot|Android'

Please be aware that this is just a text matching tool for indented result of jq(1) command. So, for example, .commit.author includes everything under it and it matches committer field name. Use jq(1) filter for more complex and precise operation.

CAUTION

greple(1) commands read entire input before processing. So it should not be used for gigantic data or infinite stream.

INSTALL

CPANMINUS

$ cpanm App::Greple::jq

OPTIONS

LABEL SYNTAX

EXAMPLES

Search from any name labels.

greple -Mjq --IN name _mina

Search from .process.name label.

greple -Mjq --IN .process.name _mina

Object .process.name contains _mina and .event contains EXEC.

greple -Mjq --IN .process.name _mina --IN .event EXEC

Object ppid is 803 and .event contains FORK or EXEC.

greple -Mjq --IN ppid 803 --IN event 'FORK|EXEC'

Object name is _mina and .event contains CREATE.

greple -Mjq --IN name _mina --IN event 'CREATE'

Object ancestors contains 1132 and .event contains EXEC with arguments highlighted.

greple -Mjq --IN ancestors 1132 --IN event EXEC --IN arguments .

Object *pid label contains 803.

greple -Mjq --IN %pid 803

Object any <path> contains _mina under .file and .event contains WRITE.

greple -Mjq --IN .file..path _mina --IN .event WRITE

TIPS

SEE ALSO

App::Greple, https://github.com/kaz-utashiro/greple

https://stedolan.github.io/jq/

AUTHOR

Kazumasa Utashiro

LICENSE

Copyright ©︎ 2022-2024 Kazumasa Utashiro

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.