awk problem

i have an email list in file.txt with comma separated

line1 - FIELD1,pippo@gmail.com,darth@gmail.com
line2 - FIELD2,pippo@gmail.com,darth@gmail.com,sampei@gmail.com
output=(awk -F ',' -v var="$awkvar" '$1==var {print $2,$3,$4}' spreadsheet.txt)

but awk delete some letters at the beginning of the output

echo "$output"

ippo@gmail.com darth@gmail.com
pippo@gmail.com darth@gmail.com sampei@gmail.com

but if i remove $4

ouput=(awk -F ',' -v var="$awkvar" '$1==var {print $2,$3}' spreadsheet.txt)

echo "$output"

it is correct display for line1 but not for line2:

pippo@gmail.com darth@gmail.com
pippo@gmail.com darth@gmail.com

What am I doing wrong?

Where did you close the single quote that you opened at :

'$1==var ?

What is the content of your $awkvar variable ?

i have modified
my copying error

What is the content of your $awkvar variable ? (wouldn't you use ~ rather than == ? ... of course depending on what you have and what you need).
Did you export it ?
Did you make sure your input file does not contain some invisible character ?
(editing it in vi for example and using :set list , or using -v option of cat )

$awkvar is match with FIELD1, FIELD2, FIELD3
awk print line that is equal to $awkvar
input file is correct, i have check it with cat -v

How big is your input file ? ... a variable has a limited length

by the way did you try

output=$( ... )

instead of

output=( ... )

?

Please provide a full example of input and code you use

for fullname in *.zip; do
    filename="${fullname##*/}"
    awkvar=$(echo $filename | cut -d_ -f2-2)
output=$(awk -F ',' -v var="$awkvar" '$1==var {print $2,$3}' spreadsheet.txt)
echo $output

$awkvar is FIELD1,FIELD2,FIELD3 ecc. ecc.

If it is your "full" code ... the done is obviously missing.

did you try replacing

output=$(awk -F ',' -v var="$awkvar" '$1==var {print $2,$3}' spreadsheet.txt) 
echo $output

with something like

awk -F ',' -v var="$awkvar" '$1==var {print $2,$3}' spreadsheet.txt >>output 
done
cat output

(What is in blue may not be necessary, it depends on what you expect and what you get)

Please provide what you get when entering the following commands :

ls -1 | grep .zip$
cat spreadsheet.txt

Sounds like a non-*nix input file. Please post spreadsheet.txt and/or a hexdump of it.