Returns a list with the first lines of a file. The number of lines should be indicated in the attribute lines.
1 file.head
<file.head lines='lines'>
<file /> !
</file.head>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Alines | number | Number of lines which must be obtained from the beginnning of the file including the first line. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Efile | file |
Returns | |
---|---|
Type | Description |
Array | An array with the first n lines of the file. |
Example
get the first 10 lines of a file.
Copy
<xsql-script name='file_head_sample1'> <body> <set name='m_srcfile'> <string>c:<file.separator />source<file.separator />deister.txt</string> </set> <println> <set name='arr'> <file.head lines='10'> <file name='#m_srcfile' type='absolute' /> </file.head> </set> <println> <arr/> </println> <iterator name='line' index='idx'> <in> <arr/> </in> <do> <println><idx/>: <line /></println> </do> </iterator> <println> </body> </xsql-script>