awk(1) on Solnix vs Linux and the BSDs
On Solnix, awk at /usr/bin/awk is the illumos awk, and the page says nawk is now the system default awk. Its options are only -F, -f, -v and -safe. It has none of gawk's GNU long options, and none of the -version/-V or --csv options of the BSD awks.
The manual pages
- Solnix: awk(1) from
pkgs.solnix.illumos-world-man· illumos.org - Linux: awk(1) gawk-5.4.1
- FreeBSD: awk(1) 15.1-RELEASE
- OpenBSD: awk(1) 8.0
- NetBSD: awk(1) 11.0
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
awk
What Solnix runs
A default Solnix system runs the illumos /usr/bin/awk. /usr/bin/nawk has the same synopsis, and /usr/xpg4/bin/awk is also shipped. The page's DESCRIPTION says nawk is now the system default awk for illumos. The bundle does not say how /usr/xpg4/bin/awk behaves differently from /usr/bin/awk. oawk(1) is listed in SEE ALSO, but the bundle does not describe it.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| Linux | gawk, not the same program | Linux awk(1) is gawk, the GNU implementation, with many GNU long options and extensions (--lint, --posix, --csv, --include, --load, --bignum and others). Solnix awk documents only -F, -f, -v and -safe. A script using GNU options fails on Solnix.Source: Solnix awk(1) SYNOPSIS, OPTIONS; Linux awk(1) (gawk) OPTIONS |
| Linux | -e / --source and --include | gawk offers -e program-text and -i include-file (--include). The Solnix page documents neither. The program must be the first operand or come from one or more -f files.Source: Linux awk(1) -e, -i; Solnix awk(1) OPTIONS, OPERANDS (program) |
| FreeBSD, OpenBSD | --csv | FreeBSD and OpenBSD awk accept --csv for CSV records. Linux gawk has --csv (-k). The Solnix page documents no CSV mode, so CSV input must be parsed in the awk program. On OpenBSD, --csv makes attempts to change FS or RS ignored.Source: FreeBSD awk(1) --csv; OpenBSD awk(1) --csv; Linux awk(1) -k, --csv; Solnix awk(1) OPTIONS |
| all four | -safe semantics | Solnix -safe prevents opening new files and running child processes, and leaves ENVIRON uninitialized. FreeBSD and OpenBSD describe it as disabling file output, process creation and ENVIRON, calling it a not very reliable approximation. NetBSD makes unsafe functions such as system() abort with a warning. The Linux page in the bundle has no -safe.Source: Solnix awk(1) -safe; FreeBSD awk(1) -safe; OpenBSD awk(1) -safe; NetBSD awk(1) -safe |
| FreeBSD, OpenBSD, NetBSD | version flag | FreeBSD and NetBSD print the version with -version, and OpenBSD with -V. The Solnix page documents no version option.Source: FreeBSD awk(1) -version; NetBSD awk(1) -version; OpenBSD awk(1) -V; Solnix awk(1) OPTIONS |
| FreeBSD, OpenBSD, NetBSD | -d debug option | The BSD awks accept -d[n] to set a debug level. The Solnix page documents no such option. On Linux, -d[file] is gawk's dump-variables option, which writes global variables to a file (default awkvars.out).Source: FreeBSD awk(1) -d[n]; OpenBSD awk(1) -d[n]; NetBSD awk(1) -d[N]; Linux awk(1) -d, --dump-variables; Solnix awk(1) OPTIONS |
| FreeBSD, OpenBSD, NetBSD | -F single-character value 't' | FreeBSD, OpenBSD and NetBSD treat -F t as a tab, and a literal t needs -F '[t]'. The Solnix page does not document this special case; it says only that -F ERE sets the separator to an extended regular expression.Source: FreeBSD awk(1) DESCRIPTION (‘t’ and ‘[t]’); OpenBSD awk(1) DESCRIPTION; Solnix awk(1) -F |
| all four | command-line assignments timing | On Solnix, a var=value operand is applied just before the next file is processed, after BEGIN if it precedes the first file, and before END if it follows the last. FreeBSD, OpenBSD and NetBSD say an assignment runs when the file would have been opened. Source: Solnix awk(1) OPERANDS (assignment); FreeBSD awk(1) DESCRIPTION; OpenBSD awk(1) DESCRIPTION; NetBSD awk(1) DESCRIPTION |
| all four | character vs byte handling | Solnix documents index, length, match and substr as dealing with characters, not bytes. Linux gawk has -b (--characters-as-bytes) to treat input as single-byte characters. The BSD pages in the bundle do not say.Source: Solnix awk(1) USAGE; Linux awk(1) -b, --characters-as-bytes |
| all four | LC_NUMERIC | Solnix awk reads LC_NUMERIC for the radix character in numeric input and output. The period is always the decimal point in awk programs, including command-line assignments. gawk needs -N (--use-lc-numeric) to use the locale's decimal point when parsing input.Source: Solnix awk(1) ENVIRONMENT VARIABLES (LC_NUMERIC); Linux awk(1) -N |
Standards
- POSIX: awk is a POSIX.1-2024 utility.
- Solnix: The page lists XPG4(7) in SEE ALSO and ships
/usr/xpg4/bin/awk.The bundle states no further conformance claim. - Linux: gawk conforms to the definition of the language in the POSIX 1003.1 standard.
- FreeBSD: The page notes that splitting into one field per character when FS is null is unspecified in IEEE Std 1003.1-2008 (“POSIX.1”).
Writing portable scripts
- Stick to
-F,-fand-vand a program in quotes. These are the only options on all five awks in the bundle. - Do not use
-safe,--csv,-e,-versionor-Vin portable scripts: their meaning differs or they are missing on some systems.
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.