grep

    grep command for MoonX.

    command-line
    moonx
    wasm
    Download zip
    Author
    Version
    0.3.8
    License
    Apache-2.0
    Last updated
    14 hours ago
    Downloads
    239

    #grep

    Search files or standard input for matching records through MoonX.

    #Usage

    moonx cli/grep -n 'error' app.log moonx cli/grep -E 'warn|error' app.log moonx cli/grep -F 'literal.text' input.txt

    Use basic regular expressions by default, -E for extended expressions or -F for literals. Exit 0 for a match, 1 for no match and 2 for errors.

    #Common options

    OptionDescription
    -F, --fixed-stringsMatch literal strings.
    -E, --extended-regexpUse extended regular expressions.
    -o, --only-matchingPrint each nonempty matched part separately.
    -i, --ignore-caseIgnore case in the selected character profile.
    -n, --line-numberPrint record numbers.
    -r, --recursiveRecurse without following links.
    -C VALUE, --context VALUEPrint this many records before and after a match.
    --helpShow help.
    --versionShow the version.

    Use --help for the complete option list.

    #Notes

    Pattern files and -f - both require UTF-8. Input records and matched output preserve arbitrary bytes.

    Build from source with the MoonBit 1.0 RC1 toolchain.

    • In C.UTF-8 and C.utf8, patterns consume Unicode scalars and -i uses simple uppercase equivalence. Byte offsets and -o output refer to the original input. C retains byte matching and ASCII case folding.
    • -a preserves malformed bytes in selected records. With the default output policy a malformed output line triggers the binary-match diagnostic. -I suppresses that line. Backreferences may require additional time and memory.

    See the compatibility guide for the supported profile.

    Source Files