Assigning a value to variable

Another newbie to Unix scripting Q..

How do you assign a value resulting from a command, such as awk, to a variable.

I am currently trying:-

$awk '{print $1}' file1 > variable1

with no change to $variable1.

The line:

$awk '{print $1}' file1

does print the first line of the file, so this is not an issue...

Cheers

In ksh:

var=`awk '{print $1}' yourfile`

{print $1} will print first column not the first record.

Regards,
Tayyab

Ah ok, my file only has one column per line in any case, so it is not an issue here.

Thanks shereenmotor, adding ` ` around the awk statement allows the variable to take the result value of that statement.