awkpretty [ --? ] [ --action-column nnn ] [ --action-separator str ] [ --awklex-input ] [ --blanks-only ] [ --comment-column nnn ] [ --file awk-program-file ] [ --function-separator str ] [ --globals ] [ --help ] [ --indent nnn ] [ --quick ] [ --reorder-functions ] [ --standard-comments ] [ --version ] [ --width nnn ] [ awk-program-file(s) ] > new-awk-program-file
It uses awklex(1) to obtain a lexical token stream derived from a grammatical analysis of the input file(s), and then outputs that stream as an awk(1) program with standardized spacing and line breaks, generally improving readability.
Options that take a value expect it as a separate following command-line argument: use -w 72, not -w72.
This option is provided for the convenience of other tools that themselves process, or produce, lexical token streams, allowing them to use awkpretty as a backend filter to reconstruct awk program text.
[Default: Input is awk program text]
[Default: use horizontal tabs and blanks, because that is shorter, and also more likely to preserve the intended text alignment when minor edits are made]
A zero value suppresses columnar alignment: inline comments will be prefixed by only a single tab.
Multiple -f options can be used, if required; their files are then treated as if logically concatenated in the order that they were specified.
The filename can be a hyphen, -, meaning that input should be taken from stdin, allowing awkpretty to be used in the middle of a command pipeline.
Because the awk programming language does not have variable declarations, function-local variables are conventionally created by declaring them as additional arguments, unused by callers. Failure to do so can result in a nasty bug when an assignment to a supposedly local variable in a function silently modifies a global variable. This option provides a way to detect such errors.
[Default: no list of global variables]
Values outside the range 0 ... 8 will be reset to the nearer endpoint of that range.
The choice between tabs-and-blanks, or just blanks, for the leading indentation depends on whether --blanks-only was specified or not.
If the initialization file contains backslashes, they must be doubled because the text is interpreted by the shell before awkpretty sees it.
In large programs, there is rarely any reason to use any order of function definition other than alphabetical, because that is the only order that other human readers are sure to understand.
[Default: leave functions in their original order]
However, with this option, awkpretty converts comments to a style found useful by decades of practice in LISP programming: three or more leading comment start characters (###) mean that the comment must be flush left; doubled start characters (##) mean that the comment must be aligned at the current statement indentation; a single start character (#) means that the comment should be aligned at the default comment column.
Comments that do not conform to these start character conventions are modified as follows. Comments that are found at beginning of line are untabified, then adjusted to begin with three start characters (###). Comments found indented are untabified, and adjusted to begin with two such characters (##). All other comments (those following non-blank tokens) are adjusted to begin with a single start character (#). The comment is then output according to the conventions described in the previous paragraph.
[Default: leave comments unmodified, though possibly changed in indentation]
A zero value of nnn is treated as `infinity', effectively preserving line breaks from the input file.
Nelson H. F. Beebe Center for Scientific Computing University of Utah Department of Mathematics, 322 INSCC 155 S 1400 E RM 233 Salt Lake City, UT 84112-0090 USA Email: email@example.com, firstname.lastname@example.org, email@example.com WWW URL: http://www.math.utah.edu/~beebe Telephone: +1 801 581 5254 FAX: +1 801 585 1640, +1 801 581 4148