16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

n = ord(expr)<br />

Returns the integer value of first character in the string value of expr. This<br />

is useful in conjunction with %c in sprintf.<br />

str = tolower(expr)<br />

Converts all letters in the string value of expr into lowercase, and returns<br />

the result. If you omit expr, tolower uses $0 instead. This function uses the<br />

value of the locale or the LC_CTYPE environment variable.<br />

str = toupper(expr)<br />

Converts all letters in the string value of expr into uppercase, and returns<br />

the result. If you omit expr, toupper uses $0 instead. This function uses the<br />

value of the locale or the LC_CTYPE environment variable.<br />

<strong>System</strong> function<br />

status = system(expr)<br />

Runs the string value of expr as a command. For example, system(″tail ″<br />

$1) calls the tail command, using the string value of $1 as the file that tail<br />

examines. The standard command interpreter runs the command, as<br />

discussed in the Portability, and the exit status returned depends on that<br />

command interpreter.<br />

User-defined functions<br />

You can define your own functions using the form:<br />

function name(parameter-list) {<br />

statements<br />

}<br />

A function definition can appear in the place of a pattern {action} rule. The<br />

parameter-list argument contains any number of normal (scalar) and array variables<br />

separated by commas. When you call a function, awk passes scalar arguments by<br />

value, and array arguments by reference. The names specified in parameter-list are<br />

local to the function; all other names used in the function are global. You can define<br />

local variables by adding them to the end of the parameter list as long as no call to<br />

the function uses these extra parameters.<br />

A function returns to its caller either when it runs the final statement in the function,<br />

or when it reaches an explicit return statement. The return value, if any, is specified<br />

in the return statement (see Actions).<br />

Patterns<br />

A pattern is a regular expression, a special pattern, a pattern range, or any<br />

arithmetic expression.<br />

BEGIN is a special pattern used to label actions that awk performs before reading<br />

any input records. END is a special pattern used to label actions that awk performs<br />

after reading all input records.<br />

You can give a pattern range as:<br />

pattern1,pattern2<br />

This matches all lines from one that matches pattern1 to one that matches pattern2,<br />

inclusive.<br />

If you omit a pattern, or if the numeric value of the pattern is nonzero (true), awk<br />

runs the resulting action for the line.<br />

awk<br />

Chapter 2. Shell command descriptions 41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!