Run sd in the browser
Find and replace text with familiar regex syntax — a simpler sed for substitutions.
Try it live
Nothing is downloaded until you press Run.
Replace with a capture group
Installs sd 1.0.0 from the signed catalog (every chunk is verified before it is written), then runs the commands below in the VM's shell.
sd --version echo 'version = 1.2.0' | sd '(\d+)\.(\d+)\.(\d+)' 'v$1.$2.$3'
$ sd --version sd 1.0.0 $ echo 'version = 1.2.0' | sd '(\d+)\.(\d+)\.(\d+)' 'v$1.$2.$3' version = v1.2.0
What it is
sd replaces text using the regex syntax of JavaScript and Python, with literal mode (-F) and capture groups ($1), and edits files in place when given paths. It avoids sed's escaping rules for the common substitution case. In the browser it rewrites files in the VM as part of client-side tooling.
Package facts
- version
1.0.0- runs on
- RISC-V VM (
elf-app,riscv64gc-linux-musl) - download
- 956 kB compressed · 1 file
- command
sd- requires
- nothing else — a static binary
- license
MIT(upstream)- upstream
- github.com/chmln/sd
- categories
- Text
- catalog
- generation 12, Ed25519-signed
Install and run it from your page
With the SDK, installApp resolves sd 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("sd"); // signature-verified, cached in OPFS
const r = await nano.shExec("sd --version");
console.log(r.stdout);Typical usage of the upstream command-line tool:
sd 'from "(\w+)"' 'from "@lib/$1"' src/*.ts
Related apps
- ripgrep14.1.0Search file contents recursively with a regex, fast, respecting .gitignore.RISC-V VM9.2 MB
- choose1.3.7Select fields from each line by index or range — a human-friendly alternative to cut and simple awk.RISC-V VM963 kB
- rnr0.5.1Rename many files and directories at once with a regex — dry run by default.RISC-V VM1.5 MB