How-To
How-To
Recipes for one task each, with the command line, Rust, Python and PowerShell side by side where each can do it. New to trex: start with the tutorial.
- Build a pattern once and reuse it - mark the fields in one line, save the pattern, read new lines with it.
- Query the records of a log - keep entries of several lines that hold, or lack, the patterns you name.
- Count and rank matches - group by a rendered key and total a typed value per key.
- Redact a log and follow it - mask, keep what identifies a row, mask what the log gains.
- Search a tree of files - walk a directory, keep files by glob, list the matching files.
- Index a tree - skip the files a pattern cannot match without reading them.
- Extract fields - typed values, key and value pairs, the columns of a table.
- Lint with rules and fix - findings, CI annotations and fixes.
- Test a pattern file - the texts each declaration must accept and reject.
- Filter by typed values - durations, sizes, addresses and numbers by value.
- Scan many patterns at once - one read, each match under its pattern.
- Explain why a pattern matched - kinds, checks, axis readings and the route.
- Match inside encoded content - JWT headers and claims, base64 contents.
- Summarize a log by templates - the line shapes a log repeats, and their lines.
- Scan input in pieces - matches settled chunk by chunk.
- Rename or reshape matches - templates, typed slices, computed replacements, files.
- Declare your own atoms - your identifiers as tokens: test, find, count, mask.
- Find tables - tables by their repeating token shape, in text and in a tree.
- Segment without delimiters - cut where the text stops predicting itself.
- Find outliers - values out of scale with their window, column or key.
- Match up to a symmetry - case, word shape, subnet.
- Parse with a token grammar - rules over tokens, precedence, ambiguity.
- Split run-together words - every tiling over a dictionary.
- Learn a subword tokenizer - byte-pair merges from a corpus.
- Find deep nesting - tokens past a bracket depth.
- Find repeated or new content - first sightings, and what one log has that another lacks.
- Find rare lines and out-of-order times - rare line shapes, timestamps running backward.
- Find where text changes kind - code inside prose, data inside code.
- Pre-check a corpus for a literal - a presence filter answering without a scan.
- Measure how far text compresses - the code length of a context-mixing model.
- Choose a backend - CPU, device, chunks, and the compressor’s backends.