Added in 1.9.0

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

Returns a single line of text from a file.

See also $readn.


Parameter Description
filename Filename to read.
[ntswrp] (optional)
[matchtext] Matchtext to search. (optional)
[N] The Nth line.


Option Description
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 case-insensitive matchtext as a wildmatch.
W Search for case-sensitive matchtext as a wildmatch. (AdiIRC only)
r Search for matchtext as a regular expression.
p Treat command | separators as such instead of as plain text.


; 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*)

Updated by Per Amundsen about 1 year ago · 3 revisions

Also available in: PDF HTML TXT