RS | Record Separator | single character | That character separates the records. |
regular expression | Text in input matches reg exp separates records. | ||
null string | Records are separated by blank lines. The newline character always acts as a field separator, in addition to whatever value FS may have. | ||
NR | number of records seen so far | ||
FNR | The input record number in the current input file | ||
ORS | output record separator | ||
FS | Field separator | single character | Fields are separated by that character |
single space | fields are separated by runs of spaces and/or tabs and/or newlines. | ||
Null string | each individual character becomes a separate field. | ||
regular expression | |||
OFS | output field separator | ||
FIELDWIDTHS | a space separated list of numbers | each field is expected to have fixed width. The value of FS is ignored. Assigning a new value to FS overrides the use of FIELDWIDTHS, and restores the default behavior. | |
NF | number of fields | Decrementing NF causes the values of fields past the new value to be lost, and the value of $0 to be recomputed | |
IGNORECASE | Controls the case-sensitivity of all regular expression and string operations. | non-zero zero | non-zero: ignore case |
Field Reference | How to reference a field | $1, $2, … $NF | Access a field. Assigning a value to an existing field causes the whole record to be rebuilt when $0 is referenced. |
$-1, $-2 | fatal error | ||
non-existent fields | For read, produce null-string. For write, 1)increase NF 2) create intervening fields with null string 3) $0 is recomputed | ||
$0 | whole record. assigning a value to $0 causes the record to be resplit, creating new values for the fields. | ||
CONVFMT | A number is converted to a string by using the value of CONVFMT as a format string for sprintf(3), with the numeric value of the variable as the argument. However, even though all numbers in AWK are floating-point, integral values are always converted as integers. | ||
OFMT |
i = "A"; j = "B"; k = "C"
x[i, j, k] = "hello, world\n"
key is "A\034B\034C" and value is "hello, world\n". Key test: val in array. for(val in array)…
No comments:
Post a Comment