OS Manuals

/usr/bin/awk

GNU awk pattern-matching language

From gawk 5.4.1-r4 (os), captured 2026-11-05 by running awk --help (exit 0). permalink

Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
Usage: awk [POSIX or GNU style options] [--] 'program' file ...
POSIX options:		GNU long options: (standard)
	-f progfile		--file=progfile
	-F fs			--field-separator=fs
	-v var=val		--assign=var=val
Short options:		GNU long options: (extensions)
	-b			--characters-as-bytes
	-c			--traditional
	-C			--copyright
	-d[file]		--dump-variables[=file]
	-D[file]		--debug[=file]
	-e 'program-text'	--source='program-text'
	-E file			--exec=file
	-g			--gen-pot
	-h			--help
	-i includefile		--include=includefile
	-I			--trace
	-k			--csv
	-l library		--load=library
	-L[fatal|invalid|no-ext]	--lint[=fatal|invalid|no-ext]
	-M			--bignum
	-N			--use-lc-numeric
	-n			--non-decimal-data
	-o[file]		--pretty-print[=file]
	-O			--optimize
	-p[file]		--profile[=file]
	-P			--posix
	-r			--re-interval
	-s			--no-optimize
	-S			--sandbox
	-t			--lint-old
	-V			--version

To report bugs, use the `gawkbug' program.
For full instructions, see the node `Bugs' in `gawk.info'
which is section `Reporting Problems and Bugs' in the
printed version.  This same information may be found at
https://www.gnu.org/software/gawk/manual/html_node/Bugs.html.
PLEASE do NOT try to report bugs by posting in comp.lang.awk,
or by using a web forum such as Stack Overflow.

Source code for gawk formal releases may be obtained from
https://ftp.gnu.org/gnu/gawk/.

Source code for gawk beta releases may be obtained from
https://www.skeeve.com/gawk/.

Alpha and beta releases have a version number >= 60 or that end in a letter.

gawk is a pattern scanning and processing language.
By default it reads standard input and writes standard output.

Examples:
	awk '{ sum += $1 }; END { print sum }' file
	awk -F: '{ print $1 }' /etc/passwd
Options (29)
OptionDescriptionSource
-f progfile--file=progfilehelp
-F fs--field-separator=fshelp
-v var=val--assign=var=valhelp
-b--characters-as-byteshelp
-c--traditionalhelp
-C--copyrighthelp
-d file--dump-variables[=file]help
-D file--debug[=file]help
-e 'program-text'--source='program-text'help
-E file--exec=filehelp
-g--gen-pothelp
-h--helphelp
-i includefile--include=includefilehelp
-I--tracehelp
-k--csvhelp
-l library--load=libraryhelp
-L fatal|invalid|no-ext--lint[=fatal|invalid|no-ext]help
-M--bignumhelp
-N--use-lc-numerichelp
-n--non-decimal-datahelp
-o file--pretty-print[=file]help
-O--optimizehelp
-p file--profile[=file]help
-P--posixhelp
-r--re-intervalhelp
-s--no-optimizehelp
-S--sandboxhelp
-t--lint-oldhelp
-V--versionhelp

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.