Save multiple results from an AWK script to c shell variables.
I have a simple AWK script running in the terminal to find max and min from an input text file.
How do we save this max and min values to c shell variable in order to use it later.
Here is the AWK
awk 'NR == 1 { xmax=$1; xmin=$1 } \
{ if ($1>xmax) xmax=$1; if ($1<xmin) xmin=$1;} \
END {printf "X-Min: %d\tX-Max: %d\n", xmin, xmax}' $inpfile
I want to save this in already defined variables lets say $xmin and $xmax
Any suggestion would be a great help, I have no prior experience with SHELL and AWK.