Project

General

Profile

Actions

Added in 1.9.0

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

Returns a single line of text from a file.

See also $readn.

Parameters

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

Options

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.

Example

; 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 9 months ago · 3 revisions

Also available in: PDF HTML TXT