parse - UDM Command
Syntax
parse string_name var_1 [seq_1 var_2]... [seq_n var_n]
Description
The parse command parses a string, placing components of the string into variables.
The first parameter, string_name, specifies the string to parse.
The var_1 parameter specifies the first component of the parsed string. (A string can be parsed into a single component.)
The seq_1 parameter specifies the sequence of the string that serves as a delimiter between var_1 and the var_2 parameter, which specifies the second component of the parsed string.
Each subsequent pair of seq_n and var_n parameters specify the delimiter (seq_n) between the preceding component and the next component (var_n).
The last var_n parameter in the command identifies the last component of the string.
Parameters
Parameter | Description |
---|---|
string_name | String to parse. |
var_1 | First component of the parsed string placed into a variable. |
seq_1 | Sequence of the string serving as a delimiter between var_1 and var_2. |
var_2 | Second component of the parsed string placed into a variable. |
seq_n | Sequence of the string serving as a delimiter between the preceding var_n and the following var_n. |
var_n | Next component of the string after the preceding seq_n. |
Examples
The following examples illustrate how parse can be used.
parse "This is my string" var1 echo "$(var1)" This is my string #comment: seq_1 equals " " parse "This is a test" var1 " " var2 " " var3 " " var4 echo "$(var1)" "$(var2)" "$(var3)" "$(var4)" Thisisatest #comment: seq_1 equals "." parse "KLH1A.DEV.UDM.TEST" var1 . var2 . var3 . var4 echo "$(var4)" TEST set string="This is a test" parse $(string) var1 " is a" var2 echo "$(var1)" "$(var2)" This test