If the first task prints the required value, it is possible to use one or more of grep, sed, and awk to locate and isolate the value. For example, to obtain the mean value of a data array you could have the following lines in your script.
set dummy = `stats accept | grep "Pixel mean"`
set mean = $dummy[4]
The accept keyword tells stats to use the current values for any parameters for which it would otherwise prompt you. The back quotes (` ` are important. They tell the shell to execute the expression they enclose, in this case stats accept | grep "Pixel mean", and assign the result to variable dummy. So the KAPPA stats task is run on the current dataset, and the output is passed to grep which searches for the line containing the string Pixel mean, and the mean value. When you equate a variable to a multi-word string not enclosed in quotes--words being separated by spaces--the variable becomes an array, whose elements are each assigned to a word. So in this case the fourth word or element is the mean value.
Besides being inelegant, this method demands that the format and
text of the output be fixed. So it should be avoided where the
first task writes results to output
parameters.
C-shell Cookbook