sed(1) on Solnix vs Linux and the BSDs
On Solnix, sed is the illumos sed at /usr/bin/sed, a BSD-style sed with -a, -E, -I/-i, -l and -r and no GNU long options. Its -l means line-buffered output, while GNU sed's -l N sets the wrap length for the l command.
The manual pages
- Solnix: sed(1) from
pkgs.solnix.illumos-world-man; the default on Solnix · illumos.org - Solnix: sed(1) from
pkgs.solnix.gnused; add the package to get it - Solnix: sed(1) from
pkgs.solnix.gsed; add the package to get it - Linux: sed(1) gnused-4.10
- FreeBSD: sed(1) 15.1-RELEASE
- OpenBSD: sed(1) 8.0
- NetBSD: sed(1) 11.0
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
sed
What Solnix runs
/usr/bin/sed is the illumos sed. /usr/xpg4/bin/sed and /usr/ucb/sed are also shipped. pkgs.solnix.gnused and pkgs.solnix.gsed also publish a sed(1) page and are not on PATH by default. The pkgs.solnix.gnused page is a stub that names GNU sed and points to its Texinfo manual.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| Linux | -l meaning | Solnix sed -l makes output line buffered and takes no argument. GNU sed -l N sets the line-wrap length for the l command, so sed -l 72 means different things on the two.Source: illumos sed(1) -l; Linux sed(1) -l N, --line-length |
| Linux | long options and GNU-only flags | Solnix /usr/bin/sed lists no long options. It has none of GNU's --expression, --in-place, --posix, --debug, --sandbox, --follow-symlinks or --version, and no -s, -z or -V.Source: illumos sed(1) SYNOPSIS; Linux sed(1) SYNOPSIS, DESCRIPTION (-s, -z, --posix, --sandbox, --follow-symlinks) |
| all four | -u unbuffered | Solnix sed documents no -u. GNU sed -u loads minimal input and flushes output more often. FreeBSD and NetBSD -u make output unbuffered. OpenBSD -u forces line-buffered output. On Solnix the closest documented option is -l (line buffered).Source: illumos sed(1) SYNOPSIS, -l; Linux sed(1) -u; FreeBSD sed(1) -u; NetBSD sed(1) -u; OpenBSD sed(1) -u |
| Linux | -i and separate files | Solnix -i makes each file independent. The Linux page lists -s, --separate as a separate option and does not say that -i implies it. Scripts that rely on per-file line numbers should pass -s on GNU sed.Source: illumos sed(1) -i; Linux sed(1) -i[SUFFIX], -s, --separate |
| FreeBSD | in-place extension argument | FreeBSD documents -i extension and -I extension with the extension as a separate argument, and a zero-length extension means no backup. Solnix takes the extension attached, as -i.bak, and saves a backup only if an extension is given.Source: FreeBSD sed(1) SYNOPSIS, -I, -i; illumos sed(1) SYNOPSIS, -I[extension], -i[extension] |
| NetBSD | GNU regex extensions flag | NetBSD has -g to turn on GNU regex extensions and -G to turn them off (the default). Solnix sed has neither flag.Source: NetBSD sed(1) -G, -g; illumos sed(1) SYNOPSIS, -E |
| Linux | -a option | Solnix -a delays creating or truncating the files named by w functions until a command writes to them. The GNU sed page documents no -a.Source: illumos sed(1) -a; Linux sed(1) DESCRIPTION (options) |
| FreeBSD | reading commands from stdin with -f - | FreeBSD reads commands from standard input when -f is given - as the file. The Solnix -f text does not say this.Source: FreeBSD sed(1) -f; illumos sed(1) -f |
| OpenBSD | no -I or -l on OpenBSD | OpenBSD sed has -i[extension] but no -I and no -l. Solnix documents -I (one line space across all files) and -l (line-buffered output).Source: OpenBSD sed(1) SYNOPSIS; illumos sed(1) -I, -l |
Everyday tasks
| Task | Solnix | Linux | FreeBSD | OpenBSD | NetBSD |
|---|---|---|---|---|---|
| apply an editing command to a file | sed -e command file | sed -e script file | sed -e command file | sed -e command file | sed -e command file |
| run editing commands from a script file | sed -f command_file file | sed -f script-file file | sed -f command_file file | sed -f command_file file | sed -f command_file file |
| print only the lines a command selects | sed -n command file | sed -n script file | — | sed -n command file | — |
| edit a file in place, with no backup | sed -i command file | sed -i script file | sed -i '' -e command file | sed -i command file | — |
| use extended regular expressions | sed -E command file | sed -E script file | — | sed -E command file | — |
| make output line buffered | sed -l command file | — | — | sed -u command file | — |
Standards
- POSIX: sed is a POSIX.1-2024 utility.
- OpenBSD: The sed utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”) specification. The flags [
-aEiru] are extensions to that specification. - OpenBSD: Following the b, t, or : commands with a semicolon and another command is an extension. Using newlines to separate commands on the command line is non-portable, but is portable inside a
-fcommand file.
Writing portable scripts
- For portable scripts use only
-n,-e,-fand-E, and put multiple commands in a-ffile, one per line. - Avoid
-i,-I,-land-u. They differ in syntax or meaning across Solnix, GNU sed and the BSDs. To edit a file, write sed output to a temporary file and move it into place.
Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.