userland.run70Try the demo
Catalog app · RISC-V VM

Run choose in the browser

Select fields from each line by index or range — a human-friendly alternative to cut and simple awk.

Try it live

Nothing is downloaded until you press Run.

catalog app

Pick fields 1 and 3 from each line

Installs choose 1.3.7 from the signed catalog (every chunk is verified before it is written), then runs the commands below in the VM's shell.

bash
choose --version
printf 'alpha beta gamma delta\none two three four\n' | choose 1 3
loading…
Expected output
$ choose --version
choose 1.3.7
$ printf 'alpha beta gamma delta\none two three four\n' | choose 1 3
beta delta
two four

What it is

choose splits each input line on whitespace (or a regex given with -f) and prints the fields you ask for, with Python-like ranges and negative indexes counted from the end. It covers the common awk '{print $2}' case without awk syntax. In the browser it is a handy step in text-processing pipelines that run entirely client-side.

Package facts

version
1.3.7
runs on
RISC-V VM (elf-app, riscv64gc-linux-musl)
download
963 kB compressed · 1 file
command
choose
requires
nothing else — a static binary
license
GPL-3.0-or-later (upstream)
upstream
github.com/theryangeary/choose
categories
Text
catalog
generation 12, Ed25519-signed

Install and run it from your page

With the SDK, installApp resolves choose in the signed index, fetches its content-addressed chunks from the CDN, verifies each one and writes the files into the VM. Details in Installing catalog apps.

javascript
import { createNano } from "@userland-run/nano-sdk";

const nano = await createNano({ image: { wasm: "/nano/console.wasm" }, ramMB: 512 });
await nano.installApp("choose"); // signature-verified, cached in OPFS

const r = await nano.shExec("choose --version");
console.log(r.stdout);

Typical usage of the upstream command-line tool:

bash
ps aux | choose 0 10

← All 32 catalog apps