General format of the awk command:
awk ' {pattern + action} ' {Filenames}
Call awk:
1. Command-line mode:awk[-F Field-separator]'commands'input-file(s) commands is the real awk command, [-f Domain delimiter] is optional. input-file(s) is the file to be processed. 2The . Shell script will input all awk commands into the file, and then the awk command interpreter as the first line of the script (#bin/awk). 3Insert all awk commands into a separate file, and then call:awk-Fawk-script-fileinput-file(s) among them,The-f option loads the awk script in Awk-script-file.
Built-in variable table:
$ |
Current record (as a single variable) |
$1~ $n |
The nth field of the current record, separated by FS between fields |
Fs |
Input field delimiter is blank by default |
Nf |
The number of fields in the current record, that is, how many columns |
Rs |
Enter the delimiter for the record, which is the line break by default |
OFS |
Output field delimiter is blank by default |
ORS |
Output record delimiter, default is line break |
ARGC |
Number of command line arguments |
Argv |
Array of command-line arguments |
FILENAME |
Current input file name |
IGNORECASE |
If true, the matching of the case is ignored |
Argind |
argv identifier of the currently processed file |
Convfmt |
Digital conversion Format%.6g |
ENVIRON |
UNIX Environment variables |
Errno |
UNIX System error messages |
FieldWidths |
Blank delimited string for input field width |
FNR |
Current Record Count |
Ofmt |
The output format of the number%.6g |
Rstart |
The first string matched by the matching function |
Rlength |
String lengths matched by matching function |
Subsep |
\034 |
|
|
2. Text Analysis tool-awk