FILE()¶
Synopsis¶
Read or write text file.
Description¶
Read and write text file in character and line mode.
Examples:
Read mode (byte):
same => n,Set(foo=${FILE(/tmp/test.txt,10)})
same => n,Set(foo=${FILE(/tmp/test.txt,10,10)})
same => n,Set(foo=${FILE(/tmp/test.txt,3,,l)})
same => n,Set(foo=${FILE(/tmp/test.txt,3,1,l,d)})
same => n,Set(FILE(/tmp/test.txt,0,1)=bar)
same => n,Set(FILE(/tmp/test.txt,20,10)=bar)
Note
If 'live_dangerously' in 'asterisk.conf' is set to 'no', this function can only be executed from the dialplan, and not directly from external protocols.
Syntax¶
Arguments¶
-
filename
-
offset
- Maybe specified as any number. If negative, offset specifies the number of bytes back from the end of the file. -
length
- If specified, will limit the length of the data read to that size. If negative, trims length bytes from the end of the file. -
options
-
l
- Line mode: offset and length are assumed to be measured in lines, instead of byte offsets. -
a
- In write mode only, the append option is used to append to the end of the file, instead of overwriting the existing file. -
d
- In write mode and line mode only, this option does not automatically append a newline string to the end of a value. This is useful for deleting lines, instead of setting them to blank.
-
-
format
- The format parameter may be used to delimit the type of line terminators in line mode.-
u
- Unix newline format. -
d
- DOS newline format. -
m
- Macintosh newline format.
-
See Also¶
Generated Version¶
This documentation was generated from Asterisk branch 22 using version GIT