rrParseOutput
This tool executes any commandline and parses the output. It can be used to
- either return true/1 or false/0 as result (Use %ERRORLEVEL%, $? or $status in the next commandline)
You can add a switch into any batch file with this mode. - or add these values to a .csv table file. E.g. to create a list of supported features on a client
Commandline parameter for all modes
[Commandline]: If your commandline has a path or flags with spaces, please use ' or \" around each of these flags.
Then place " " around the whole commandline if it contains commandline flags.
Example: rrParseOutput find " 'C:\Program Files\my App\myApp.exe' -flag1 -name 'John Smith' "
[-verbose]: print verbose messages.
[-showCmdOutput]: Show the output of the commandline.
Commandline parameter for each mode
1. Find mode
rrParseOutput "[commandline]" find "[string1 to find (case sensitive)]" "[string2 to find (case sensitive)]" ... [-verbose] [-showCmdOutput]
[string1 to find] options:
If one of the specified strings is found, this tool returns 'TRUE' as string and 1 as error exit code.
2. Compare mode
rrParseOutput "[commandline]" compare [begin;;end] [Q-][operator] "[String to compare with (case sensitive)]" ... [-verbose] [-showCmdOutput]
[begin;;end]:
Specify the part to be extracted by a begin string and an end string, seperated by an ;; . Case sensitive.
If nothing is specified after ;;, then it ends at the end of the line. Otherwise the extracted part can contain multiple lines.
[Q-][operator]:
If the comparison is true, then this tool returns 'TRUE' as string and 1 as error exit code.
The operator can be one of the following settings:
larger: A string comparison which is true if the extracted string is larger than [String to compare with]
smaller: A string comparison which is true if the extracted string is smaller than [String to compare with]
largerCI / smallerCI: Same as above, but the comparison is case IN-sensitive (lowercase comparison)
largerNumber / smallerNumber: The strings are converted into a number before comparison.
If the extracted string cannot be converted into a number, then this application returns 'false', 0
If a point . or comma , is found, then this character is assumed to be the decimal seperator
See number notes at the end of this help as well
largerNumberP/ smallerNumberP: The decimal seperator is always a point . and the thousands separator is a comma ,
largerNumberC/ smallerNumberC: The decimal seperator is always a comma , and the thousands separator is a point .
[Q-]: If Q- is prepended, then the comparison is true if the values are equal. .
Example: Q-larger means "equal or larger than"
[String to compare with]:
The string that is used to compare the found value with.
3. Table mode
rrParseOutput "[commandline]" table "[/path/myTable.csv]" "Column1Nname=value" "Column2Name=value" "Column3Name=value" "Column4Name=value" ... [-verbose] [-showCmdOutput] [-addAllClients]
[/path/myTable.csv]:
The name of the table file that is written.
Note: As long as no machine is executing this command, you can edit and save the file.
You can sort rows, but you must not change the order of the columns.
[ColumnName=value]:
Specify each column of the table. Each column is specified with name=value
The name can be anything (the = character is not allowed!)
The value can contain:
|
a) name=Myvalue |
Hardcoded value. Must not contain double semicolons ;; . |
|
b) name=[VarName] |
Any environment variable as OS format or as rrParseOutput [], including special rrParseOutput variables (see bottom of this help) |
|
c) name=begin;;end |
Specify the part to be extracted by a begin string and an end string, separated by two semicolons ;;. If nothing is specified after the semicolons ;; , then it ends at the end of the line. Otherwise the extracted part can contain multiple lines. |
|
d) name,Number=begin;;end |
Same as above, but the extracted string is converted into a number. This is useful to convert different number formats into an Excel-readable number. See number notes at the end of this help as well. |
|
e) name,NumberC=begin;;end |
Same as number, but the decimal seperator must be a point . |
|
f) name,NumberP=begin;;end |
Same as number, but the decimal seperator must be a comma , |
|
g) name,NumberTime=begin;;end |
Time format min:sec and h:min:sec is converted into seconds. Works for h:min as well, but the result is in minutes. |
|
h) name=find=substring |
String to be found, results in true/false values. The search is case sensitive. If you specify the same value string for the next find command, then the second output parser starts at the location the first string was found. |
|
i) name=[success] |
The value is 'TRUE' in case the commandline was executed, otherwise 'false' |
|
j) name=[error] |
In case the commandline was not executed, this value contains the error message of the system |
There are special options to keep column values in case the row for e.g. the workstation already exists:
name,Unique=value First column only! If the name ends with ",Unique" , then the row starting with the same value will be replaced with the new values.
name=*,value If the value is *, at the beginning, then the old value is kept. The value of this column is not replaced with any new value.
[nothing] rrParseOutput will keep all existing columns in the csv file if you do not specify the column in this execution.
Examples:
Workstation,Unique=[host]
"Date Added=*,[date]"
Updated=[date]
Executed=[success]
Error=[error]
Number of CPUs=number-Cpus:;;Cores:
Memory=*,number-Memory:;;
"SupportSSE=find=SSE is supported"
"1st GPU= found GPU:"
"2nd GPU= found GPU:"
[-addAllClients]: When the table is created the first time, then rrParseOutput gets a list of all clients and adds them to the file with all other columns empty.
This opion requires the first column to be "Workstation,Unique=[host]"
Without this flag, clients are added once they execute the command. You have to check the job assignment in rrControl to know which Client has NOT executed the job.
With this flag you always have a list of all client and you can see which client has not yet executed the command.
Special notes
rrParseOutput supports special variables for the commandline, table filename and column options.
[host]: hostname of the machine that executes this application
[dateFile]: Date and time as filename save format YearMonthDate_HourMinuteSecond 161231_23595
[dateMonth]: Date as date.month.year 31.Dec.16
[date]: Date as date.month.year 31.12.2016
[time]: Time as hour:minute 23:59 (cannot be used for file names)
System variables are supported, they have to be in the format <user>.
(NOT $User or %User%)
Number notes:
All number conversions have some special functions to convert any displayed number string into a number.
- Spaces and Tabs are removed. For example 120 123 => 120123
- If no decimal seperator is specified, then a point is used if a point is found and a comma if a comma is found.
If none or both are found, then the systems regional setting is used.
- Byte size units are converted. First 'byte' is replaced with 'B', then units are converted. E.g. 1 KiB => 1024.
Known units are : PiB, TiB, GiB, MiB, KiB, PB, TB, GB, MB, KB, P, T, G, M, K, PebiB, TebiB, GibiB, MebiB, KibiB, PetaB, TeraB, GigaB, MegaB, KiloB
Known Units have to be a standalone word. E.g. The 'T' in '120 Toys' is not recognized as unit 'T'.
- Non-digits in front of the number are removed. Non-digits after the number are removed after the byte conversion.
- If the string cannot be converted, then a comparison is always false and the table exporter uses the string value
- The table exporter uses the local system regional settings for floating point numbers. E.g. If your Windows language is German, then the output is for example 1,3333 .