ai4d-iasc / trixie

Scripts and documentation about trixie hpc
17 stars 3 forks source link

`jq` with compiled with ONIGURUMA #76

Closed SamuelLarkin closed 2 years ago

SamuelLarkin commented 2 years ago

Please add a version of jq that is compiled with ONIGURUMA.

Error message that I'm currently getting.

jq was compiled without ONIGURUMA regex libary. match/test/sub and related functions are not available.
nrcfieldsa commented 2 years ago

Installation of jq with ONIGURUMA support to trixie. Please confirm if works ok:

module load jq

Note: the main release of jq is found in Compute Canada base. This release of jq is standalone from spack and thus must be loaded separately

SamuelLarkin commented 2 years ago

jq is now using ONIGURUMA as I'm able to use the test command.

jq 'select(.fr | test("<[^>]+>"))' test.jsonl
{
  "en": "<Affiliation DbId=\"252885\" Type=\"2\">Mr. Jasraj Singh Hallan (Calgary Forest Lawn, CPC)</Affiliation>:",
  "fr": "<Affiliation DbId=\"252885\" Type=\"2\">M. Jasraj Singh Hallan (Calgary Forest Lawn, PCC)</Affiliation>:",
  "id": "House/House/432/Debates/121/HAN121 1356",
  "tag": "PersonSpeaking",
  "language": "English"
}

Info

Regular expressions (PCRE) jq uses the Oniguruma regular expression library. The jq regex filters are defined so that they can be used using one of these patterns:

STRING | FILTER( REGEX )

where: STRING, REGEX and FLAGS are jq strings and subject to jq string interpolation; REGEX, after string interpolation, should be a valid PCRE regex; * FILTER is one of test, match, or capture, as described below.