storing a command in a variable

how would i go about storing this command in a variable

echo "$LINE" | awk -F"|" '{print $1"|"$2"|"$3"}'

i have tried FOO = ${command up there} but receive the error FOO: not found

aswell as a couple of other attempt but no luck

FOO=$(echo "$LINE" | awk -F"|" '{print $1"|"$2"|"$3"}')

Hi.

There is a difference between storing the text of a command and storing the results of a command in a variable; vino provided the latter. In any case, you need to omit the spaces around the "=" sign. If you have a space, then the Bourne family shells will assume you wish to run a command, such as FOO. That usually produces an error message, as you have seen.

It is good that you provided the evidence for your problem. However, data and commands are far easier to read when you place them inside CODE blocks as vino did. To do that, select the text and press the # just above the editing window.

Best wishes ... cheers, drl