bloom(1)
π bloom(1) π
okay bestie, sit down, hydrate, because we're about to talk about the bloom utility β it's the main character of the Bloom filter world and it lives in section 1 of the manual. periodt β¨
β¨ SYNOPSIS β¨
bloom [global options] command [command options] [arguments...]
like, that's the whole shape of it: global options first, then a command, then that command's own options, then whatever arguments you're throwing at it. no cap. π«Ά
πΈ DESCRIPTION πΈ
This is THE main tool for interacting with Bloom filters, bestie. Creating them, filling them, querying them β the whole glow-up pipeline. π
π BASIC USAGE π
creating one, because duh
To spin up a brand new Bloom filter with a capacity and a false positive probability that you choose, you use create:
#will create a gzipped Bloom filter with 100.000 capacity and a 0.1 % false positive probability
bloom --gzip create -p 0.001 -n 100000 test.bloom.gz
yes, she's gzipped, yes she's 100.000 capacity, yes she's 0.1 %. iconic behaviour honestly. β¨
filling her up
To insert values, use the insert command and pipe some input into it. Every single line gets treated as one value, so don't be out here adding random blank lines unless you mean it:
cat values | bloom --gzip insert test.bloom.gz
the interactive route π¦
You can also add values to the filter interactively, live, one at a time, by specifying the --interactive option:
bloom --gzip --interactive insert test.bloom.gz
it's giving conversational, it's giving intimate, we love that for her.
the vibe check (a.k.a. checking)
To check whether a given value β or a whole list of values β is in the filter, use check:
cat values | bloom --gzip check test.bloom.gz
This will return a list of all values in the filter. so you get your little roster back and you can go "oh okay so THOSE ones" π
π₯ ADVANCED USAGE π₯
okay so sometimes you wanna attach extra info to a string that you're checking against the Bloom filter. like a timestamp, or the original line content, whatever. and to make passing that extra info around in a shell context easier, the Bloom tool has an option for splitting the input string by a given delimiter and checking the filter against the resulting field values. chef's kiss π§
# will check the Bloom filter for the values foo, bar and baz
cat "foo,bar,baz" | bloom -s filter.bloom
# uses a different delimiter (--magic-delimiter--)
cat "foo--ac5ba--bar--ac5ba--baz" | bloom -d "--ac5ba--" -s filter.bloom
# will check the Bloom filter against the second field value only
cat "foo,bar,baz" | bloom -f 1 -s filter.bloom
# will check the Bloom filter against the second and third field values only
cat "foo,bar,baz" | bloom -f 1,2 -s filter.bloom
# will print one line for each field value that matched against the filter
cat "foo,bar,baz" | bloom -e -s filter.bloom
# will print the last field value for each line whose fields matched against the filter
cat "foo,bar,baz" | bloom -e -s --pf -1 filter.bloom
This functionality is especially handy when you're working with CSV data, because it lets you filter CSV rows by checking individual columns against the filter β no external tools needed to split and reassemble the lines. you just... do it. in one go. slay. ππ
π COMMANDS π
createβ Create a new Bloom filter and store it in the given file.insertβ Inserts new values into an existing Bloom filter.join,mergeβ Joins two Bloom filters into one.checkβ Checks values against an existing Bloom filter.set-dataβ Sets the data associated with the Bloom filter.get-dataβ Prints the data associated with the Bloom filter.showβ Shows various details about a given Bloom filter.helpβ Shows a list of commands or help for one command
π OPTIONS π
--gzip,--gzβ compress bloom file with gzip--interactive,-iβ interactively add values to the filter--split,-sβ split the input string--each,-eβ print each match of a split string individually--delimiter value,-d valueβ delimiter to use for splitting (default:",")--fields value,-f valueβ fields of split output to use in filter (a single number or a comma-separated list of numbers, zero-indexed)--print-fields value,--pf valueβ fields of split output to print for a successful match (a single number or a comma-separated list of numbers, zero-indexed).--help,-hβ show help--version,-vβ print the version
quick reminder bestie: those field numbers are zero-indexed, so the "second field" is1. don't come for me when0gets you the first one. π
and that's the whole page!! this was bloom 0.2.4, dated 24 August 2023, and she ate every single time. go forth, filter your little hearts out, ily ππβ¨π¦πΈ
π¦ where this page comes from
- ubuntu noble: golang-github-dcso-bloom-cli 0.2.4-3build1 Β· BSD-3-Clause
- ubuntu questing: golang-github-dcso-bloom-cli 0.2.4-3build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms