Awk
Overview
What is
'awk'?
Invoking 'awk'
Naming the fields
Formatted output
Operators used
by Awk
Patterns
Variables
Accessing
Values
Special
variables
Arguments to 'awk'
scripts
Arrays
Field and record
separators
Functions
List of Awk
functions
Summary
Exercises
|
List of Awk functions
Arithmetic functions
sin( x) |
returns the sine of x |
cos( x) |
returns the cosine of x |
atan2( x,y) |
returns the inverse tangent of x/y |
exp( x) |
returns the exponential of x, viz.
ex |
log( x) |
returns the natural logarithm of x |
sqrt( x) |
returns the square root of x |
int( x) |
truncates xto the nearest integer to 0 |
rand() |
returns a random number xwith
0<=x<=1 |
Other functions
tolower( s) |
returns string s with all upper-case letters in
slower-cased |
toupper( s) |
returns string s with all lower-case letters in
supper-cased |
split( s, a,
fs) |
splits string s into array elements a[1],
a[2], ..., a[n], and returns n;
separation is done with the regular expression fs |
length( s) |
returns the length in characters of string s |
getline |
moves on to the next input record $0 ,
NF , etc., are reset to their new values |
match( s, ERE) |
returns the position in string s, starting at 1, where
ERE occurs; 0 is returned if ERE does not occur
in s |
sub( ERE, rep) |
substitutes string rep for the first occurrence of
ERE in the current record |
sub( ERE, rep,
in) |
substitutes string rep for the first occurrence of
ERE in the string in |
substr( s,m) |
returns the substring of s beginning at position
m |
substr( s,m,n) |
returns the substring of s beginning at position
m of length n (or up to the end of the string, if
sooner) |
system( expression) |
evaluates expression as a shell command and
returns its exit status |
|