Added in 1.9.0

$read(filename, [ntswrp], [matchtext], [N])

Returns a single line of text from a file.

See also $readn.


filename - Filename to read.
[ntswrp] - (optional)

n - Don't evaluate any identifiers in the line.
t - Treat the first line as a plain text, even if it's a number.
s - Search for matchtext.
w - Search for matchtext as a wildmatch.
r - Search for matchtext as a regular expression.
p - Treat command | separators as such instead of as plain text.

[matchtext] - Matchtext to search. (optional)
[N] - The Nth line.


; Prints a random line from the file 'file.txt'.
//echo $read(file.txt)

; Prints line '10' from the file 'file,txt.
//echo $read(file.txt, 10)

; Searches file 'file,txt for a line beginning with the text 'Hello World' and prints the text following the match value.
//echo $read(file.txt, s, Hello World)

; Searches file 'file.txt' for a line matching the wildmatch '*Hello World*' and prints it.
//echo $read(file.txt, w, *Hello World*)