assign awk's variable to shell script's variable?

Dear All,

we have a command output which looks like :

Total 200 queues in 30000 Kbytes

and we're going to get "200" and "30000" for further process. currently, i'm using :

numA=echo $OUTPUT | awk '{print $2}'
numB=echo $OUTPUT | awk '{print $5}'

my question is : can I use just one awk statement to assign $2 to numA and $5 to numB?

Thanks.

Something like this:

echo "$OUTPUT" | awk '{print $2 $5}' | read numA numB

or:

echo "$OUTPUT" | read dummy numA dummy dummy numB dummy

bash

$ a="Total 200 queues in 30000 Kbytes"
$ set -- $a
$ echo $2 $5
200 30000

assign $2 to numA and $5 to numB

@OP: Your code would not not worik you would need:

numA=$(echo $OUTPUT | awk '{print $2}')

Anyway, if you are using a recent bash or ksh, here is a slight variation on Franklin52's post, just to make it pipeless:

read x numA x x numB x <<< $OUTPUT

also, you could do this:

num=($OUTPUT)
numA=${num[1]}
numB=${num[4]}

Solaris OS: Is there any way to modify a shell variable from awk block of code inside a shell script.

--------- [shell_awk.sh]---------------------

shell_variable=<value>

awk '
{
awk_variable = <value>

# set the value of an awk variable to shell variable
# shell_variable = awk_variable

}' $FILE

echo "New shell variable: $shell_variable"