Previous Table of Contents Next


Functions:

atan2(x,y) arctangent of x/y in radians
cos(expr) cosine of expr
exp(expr) exponential of expr
gsub(regular-expression, string1, string2) substitute string1 for all instances of regular-expression in string2. If string2 is not specified, use the current record $0.
index(string1, string2) return the position of string1 in string2
int(expr) integer value of expr
length(string) return the length of string
log(expr) natural logarithm of expr
match(string, regular-expression) return the position in string where regular-expression occurs. If not found, return 0. RSTART is set to the starting position, and RLENGTH is set to the length of string.
rand() random number between 0 and 1
sin(expr) sine of expr in radians
split(string, array) split string into array using $FS
split(string, array, fs) split string into array using fs as separator
sprintf(format, expr) format expr according to the printf format
sqrt(expr) square root of expr
srand() new seed for rand (current time)
srand(expr) set the seed for rand to expr
sub(regular-expression, string1, string2) substitute string1 for the first instance of regular-expression in string2. If string2 not specified, use the current record $0.
substr(string, x) return the suffix of string starting at position x
substr(string, x, n) return n character substring of string starting at position x
function name(args,...) {statements}
func name(args,...) {statements} name (expr, expr, . . .) define a function name

Operators:

=, +=, –=, *=, /=, %=, ^= assignment operators
?: conditional expression
||, &&, ! logical OR, logical AND, logical NOT
~, !~ regular expression match/do not match
<, <=, >, >=, !=, == relational operators
+, – add, subtract
*, /, % multiple, divide, modulo
+, – unary plus, unary minus
^ exponentiation
++, -- increment, decrement

Variables:

ARGC number of command-line arguments
ARGV array of command-line arguments
FILENAME current input file
FNR record number in current input file
FS input field separator (default blank and tab)
NF number of fields in the current record
NR number of current record
OFMT output format for numbers (default %g)
OFS output field separator (default blank)
ORS output record separator (default newline)
RLENGTH length of string matched by match()
RS contains the input record separator (default newline)
RSTART index of first character matched by match()
SUBSEP subscript separator (default \034)
$0 current input record
$n nth input field of current record

cut - Display File Fields

    $cut –clist [ files ]
    $cut –flist [ –dc ] [ –s ] [ files ]

Description:

The cut command displays fields from lines in the specified files. The fields can be of fixed or variable length.

Options:

–clist display characters from the positions in list
–dc set field delimiter to c (default tab)
–flist display fields specified in list
–s suppress lines with no delimiter characters
files read standard input if files are , or no files are specified
list comma separated list of integer field numbers; integers separated with a indicate a range

echo - Display Arguments

$/bin/echo arguments

Description:

The /bin/echo command displays arguments on standard output. Special escape characters can be used to format arguments.

Escape Characters:

\b backspace
\c line without ending newline
\f formfeed
\n newline
\r carriage return
\t tab
\v vertical tab
\\ backslash
\0x character whose octal value is x

egrep - Search Files for Patterns

$egrep [ options ]  'expression'  [ files ]

Description:

The egrep command displays lines in files that contain the given full regular expression pattern.

Options:

–b precede each line with the block number
–c display only the number of lines that match
–e –expression search for expression that begins with “
–f file get expressions from file
–i ignore case of letters during comparisons
–l display file names with matching lines once
–n display the output with line numbers
–v display non-matching lines
files read standard input if no files are specified


Previous Table of Contents Next
1