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.
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));
["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
line07
line08