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.
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.
choose --version printf 'alpha beta gamma delta\none two three four\n' | choose 1 3
$ 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.
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:
ps aux | choose 0 10
Related apps
- hck0.11.6A cut replacement that splits on regex delimiters and can reorder fields.RISC-V VM1.2 MB
- sd1.0.0Find and replace text with familiar regex syntax — a simpler sed for substitutions.RISC-V VM956 kB
- busybox1.36.1Hundreds of standard Unix utilities (sh, ls, grep, sed, awk, tar…) in a single small binary.RISC-V VM780 kB