AWK Functions

Numeric Functions


CREATED 2016-07-07 17:02:06.0

00-26-2A

UPDATED 2016-07-07 17:02:29.0

atan2(y,x)


Arctan of y/x between -pi and pi.

CREATED 2016-07-07 17:03:42.0

00-26-2C

UPDATED 2016-07-07 17:03:55.0

cos(x)


cosine function x in radians. Don't forget SOHCAHTOA. Cosine = adjacent and hypotenuse.

CREATED 2016-07-07 17:03:55.0

00-26-2D

UPDATED 2016-07-07 17:04:05.0

exp(x)


Exponential function

CREATED 2016-07-07 17:04:05.0

00-26-2E

UPDATED 2016-07-07 17:04:12.0

int(x)


{ x = 5.8 numb = int(x) print numb }

Returns x truncated toward zero i.e. to the left on the number line.

Example:





would output 5.

CREATED 2016-07-08 12:30:08.0

00-26-2F

UPDATED 2016-07-08 12:30:14.0

log(x)


CREATED 2016-07-08 12:37:00.0

00-26-30

UPDATED 2016-07-08 12:37:05.0

rand()


CREATED 2016-07-08 12:37:17.0

00-26-31

UPDATED 2016-07-08 12:37:28.0

sin(x)


CREATED 2016-07-08 12:37:28.0

00-26-32

UPDATED 2016-07-08 12:37:33.0

sqrt(x)


CREATED 2016-07-08 12:37:33.0

00-26-33

UPDATED 2016-07-08 12:37:42.0

srand([expr])


CREATED 2016-07-08 12:37:42.0

00-26-34

UPDATED 2016-07-08 12:37:59.0

String Functions


CREATED 2016-07-07 17:03:09.0

00-26-2B

UPDATED 2016-07-07 17:03:16.0

asort(source[, dest])


a gawk extention, returns the number of elements in the array source. The contents of source are sorted usding normal gawk sorting rules. All the indecies are replaced with numeric values... 1, 2, 3, etc. If dest is provides, asort stores the sorted array in dest, leaving source unchanged.

CREATED 2016-07-07 11:00:37.0

00-26-1C

UPDATED 2016-07-07 17:02:37.0

gsub(r, s[, t])


gsub is for global substitution. gsub performs the same operation as sub with the exception that gsub replaces all occurances of s.

CREATED 2016-07-07 16:58:31.0

00-26-22

UPDATED 2016-07-07 17:02:41.0

index(string, whatToFind)


var = index("abcdef", "c")

Works like index in most any other language, searches string for whatToFind . Returns the index that whatToFind is located at. Returns zero (0) if whatToFind is not in string.

Example:

would retunr 3. Note: String positions in awk are numbered 1 to n.

CREATED 2016-07-07 11:20:20.0

00-26-1E

UPDATED 2016-07-07 17:02:42.0

length([string])


Returns the length of string. This function is overloaded, if the argument string is ommited, length returns the length of the field $0.

CREATED 2016-07-07 11:00:46.0

00-26-1D

UPDATED 2016-07-07 17:02:42.0

match(s,r)


CREATED 2016-07-07 16:59:09.0

00-26-23

UPDATED 2016-07-07 17:02:43.0

split(s, A[, r])


CREATED 2016-07-07 16:59:25.0

00-26-24

UPDATED 2016-07-07 17:02:47.0

sprintf(format, expr-list)


CREATED 2016-07-07 16:59:49.0

00-26-25

UPDATED 2016-07-07 17:02:48.0

sub(r,s[,t])


CREATED 2016-07-07 17:00:24.0

00-26-26

UPDATED 2016-07-11 14:41:15.0

substr(s, i[,n])


CREATED 2016-07-07 17:00:50.0

00-26-27

UPDATED 2016-07-07 17:02:51.0

tolower(s)


CREATED 2016-07-07 17:01:09.0

00-26-28

UPDATED 2016-07-07 17:02:53.0

toupper(s)


CREATED 2016-07-07 17:01:16.0

00-26-29

UPDATED 2016-07-07 17:02:59.0

L
I
N
K
S

DBID: db.wam

Page Server: Ithica

©2019 Leistware.com
        Hello anonymous