inserted between fields on output, initially = " ".
ORS terminates each record on output, initially = "\n".
RLENGTH
length set by the last call to the built‐in function, match().
RS input record separator, initially = "\n".
RSTART index set by the last call to match().
SUBSEP used to build multiple array subscripts, initially = "\034".
8. Built‐in functions
String functions
gsub(r,s,t) gsub(r,s)
Global substitution, every match of regular expression r in variable t is replaced by string s. The number of replacements is returned. If t is omitted, $0 is used. An & in the replacement string s is
replaced by the matched substring of t. \& and \\ put literal & and \, respectively, in the replacement string.
index(s,t)
If t is a substring of s, then the position where t starts is returned, else 0 is returned. The first character of s is in position 1.
length(s)
Returns the length of string or array s.
match(s,r)
Returns the index of the first longest match of regular expression r in string s. Returns 0 if no match. As a side effect, RSTART is set to the return value. RLENGTH is set to the length of the match or
-1 if no match. If the empty string is matched, RLENGTH is set to 0, and 1 is returned if the match is at the front, and length(s)+1 is returned if the match is at the back.
split(s,A,r) split(s,A)
String s is split into fields by regular expression r and the fields are loaded into array A. The number of fields is returned. See section 11 below for more detail. If r is omitted, FS is used.
sprintf(format,expr‐list)
Returns a string constructed from expr‐list according to format. See the description of printf() below.
sub(r,s,t) sub(r,s)
Single substitution, same as gsub() except at most one substitution.
substr(s,i,n) substr(s,i)
Returns the substring of string s, starting at index i, of length n. If n is omitted, the suffix of s, starting at i is returned.
tolower(s)
Returns a copy of s with all upper case characters converted to lower case.
toupper(s)
Returns a copy of s with all lower case characters converted to upper case.
Time functions
These are available on systems which support the corresponding C mktime and strftime functions:
mktime(specification)
converts a date specification to a timestamp with the same units as systime. The date specification is a string containing the components of the date as decimal integers:
YYYY
the year, e.g., 2012
MM the month of the year starting at 1
DD the day of the month starting at 1
HH hour (0‐23)
MM minute (0‐59)
SS seconds (0‐59)
DST
tells how to treat timezone versus daylight savings time:
positive
DST is in effect
zero (default)
DST is not in effect
negative
mktime() should (use timezone information and system databases to) attempt to determine whether DST is in effect at the specified time.
strftime([format [, timestamp [, utc ]]])
formats the given timestamp using the format (passed to the C strftime function):
• If the format parameter is missing, "%c" is used.
• If the timestamp parameter is missing, the current value from systime is used.