Scroll to navigation

goawk(1) General Commands Manual goawk(1)

NAME

goawk - POSIX-compliant AWK interpreter with CSV support

SYNOPSIS

goawk [-F fs] [-v var=value] [-f progfile | 'prog'] [file ...]

DESCRIPTION

goawk is a POSIX-compliant AWK interpreter written in Go. Additionally, it has some features not provided by POSIX AWK:

  • Code coverage.
  • Proper CSV and TSV support.
  • Negative field indexes to access fields from the right.
  • Single-quoted strings.

OPTIONS

Standard AWK arguments:

--csv

Enable CSV input mode. Equivalent to -i csv.

-F fs

Use fs for the input field separator.

-F progfile

Read the AWK program source from progfile. Multiple -f options may be used.

-v var=val

Assign the value val to the variable var before the execution of the program begins.

Additional GoAWK features:

-c

Use Unicode characters for index, length, match, substr, and %c.

-E progfile

Load program from progfile, disable var=val arguments, stop processing arguments, parse header row and enable @"field" in CSV input mode.

-H

Parse header row and enable @"field" in CSV input mode.

-h,--help

Show the help message and exit.

-i mode

Parse input into fields using CSV format, ignoring FS and RS.

-o mode

Use CSV output, ignoring OFS and ORS.

-version

Show GoAWK version and exit.

GoAWK debugging arguments:

-coverappend

Append to coverage file instead of overwriting.

-covermode mode

Set coverage mode, where mode is set or count (default: set).

-coverprofile file

Write coverage profile to file.

-cpuprofile file

Write cpu profile to file.

-d

Print parsed syntax tree to stdout and exit.

-da

Print VM assembly instructions to stdout and exit.

-dt

Print variable type information to stdout and exit.

-memprofile file

Write memory profile to file.

SEE ALSO

gawk(1), mawk(1)

2024-09-18