read[int|real|string]list
Prototype: readintlist(filename, comment, split, maxentries, maxbytes)
Prototype: readreallist(filename, comment, split, maxentries, maxbytes)
Prototype: readstringlist(filename, comment, split, maxentries, maxbytes)
Return type: ilist
, rlist
or slist
Description: Splits the file filename
into separated
values and returns the list.
The comment
regex will strip out unwanted patterns from the file being read,
leaving unstripped characters to be split into fields. Using the empty string
(""
) indicates no comments.
Arguments:
filename
: File name to read, in the range"?(/.*)
comment
: Unanchored regex matching comments, in the range.*
split
: Unanchored regex to split data, in the range.*
maxentries
: Maximum number of entries to read, in the range0,99999999999
maxbytes
: Maximum bytes to read, in the range0,99999999999
Example:
bundle agent example
{
vars:
"integers" ilist => readintlist("/tmp/listofint","#.*","[\n]",10,400);
"strings" slist => readstringlist("/tmp/listofstring", "#.*", "\s", 10, 400);
"reals" rlist => readreallist("/tmp/listofreal","#.*","[\n]",10,400);
reports:
"List entry: $(mylist)";
}