Syntax
getblock(string, string, array)
getfileblock(string, string, file)
Description
The getblock() and getfileblock() return an array of strings between and including the first string an second string. getblock() will use the data on a pre-defined array, while getfileblock reads a file into an array prior to calling getblock()
Example
Data file “bdata”
block_start This is a small block of text that may or may not be seen block_end Data starts here for the second test which may also be found right up to Data ends here
// Using getblock Data=split(trim(cat("./bdata")), "\n") FirstBlock=getblock("block_start", "block_end", Data) SecondBlock=getblock("Data starts", "Data ends", Data) println("Data=", Data, "\n") println(FirstBlock,"\n", SecondBlock) println() println() Data=["block_start", "This is a small", "block of text", "that may or may not", "be seen", "block_end", "Data starts here for the second test", "which may also be found", "right up to", "Data ends here"] ["block_start", "This is a small", "block of text", "that may or may not", "be seen", "block_end"] ["Data starts here for the second test", "which may also be found", "right up to", "Data ends here"] //Using getfileblock FirstBlock=getfileblock("block_start", "block_end", "./bdata") SecondBlock=getfileblock("Data starts", "Data ends", "./bdata") println(FirstBlock,"\n", SecondBlock) ["block_start", "This is a small", "block of text", "that may or may not", "be seen", "block_end"] ["Data starts here for the second test", "which may also be found", "right up to", "Data ends here"]