<attribute> - Extracts User Info in the user_show_all Task
<attribute> tag is used only in the 'user_show_all task'.
It is used to specify the attributes of a dataset that will be passed back from the tasks, containing
various bits of information about each discovered user.
This tag has the following attributes:
name (str) : The name of the parameter whose current value is to be read.
value (str) : Sets the name of the attribute to a fixed string value. Note this value does NOT support substitutions.
word_nr (int) : Specifies the word number on the line to extract. Count starts from 1.
line_nr (int) : Specifies the line to extract from. Count starts from 0.
regex (str) : Specifies a regex with a capturing groups to extract the required value.
elem (str) : Used to extract a specific XML element value. Set this to the name of the tag to be read.
Example: Simplest Use
If the command only returns one single line with just one word and this is what you want to extract then you can use:
This extracts the entire result form the parent command, and places the result in the name field.
Example: Extract a specific word
When a command returns a line of text that is separated by spaces, each word can be extracted using the 'word_nr' or word number attribute. Simply specify the word position number required, the count starts from 1.
Example: Extract from a specific line
As well as specific words, if the device replies with a multi line reply, an individual line can be selected with 'line_nr' or line number. It is often used in conjunction with 'word_nr', like this:
If not specified, the default is the first line or line_nr="0".
Example: Extract using a regex capturing group
More complex extractions be can done with regex capturing groups. Say you have a username line separated with colons instead of spaces (like in a Linux password file) you can use this:
Only one capturing group can be used.
Example: Extracting an XML element
Used in conjunction with the XML settings in the parent command tag, you can extract element text from XML. Consider this XML output::
1 2 3 4 5 6 7 8 9 10 11 12 13 14
The user names can be extracted with:
1 2 3