Important This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent 22.1 for BMC Helix Operations Management.

tail()


Return the last lines from a text block.

Syntax

tail(text,lines)

Parameter

 

Parameter

Definition

text

text whose last lines are to be returned The text can be a text string enclosed in double quotation marks, or one or more PSL commands that produce text as output.

lines

number of lines of text to be returned, starting from the last line of text

 

Description

The tail() function returns the last lines number of lines of text. It is equivalent to the Unix tail(1) command.

The tail() function does not perform file I/O. If reading text from a file, you must use the cat() function for file I/O. For more information, see cat().

Example

The following example uses the tail() function to return the last three lines from a PSL list:

psl_list =
["line01","line02","line03","line04","line05","line06","line07","line08"];
printf("%s\n",tail(psl_list,3));
psl_list = "This \n the \n last \n line";
printf("%s\n",tail(psl_list,3));

The example produces the following output:

line06
line07
line08