awk syntax error

can anyone see the awk syntax error near line 1? I keep getting this error and I'm not familiar with awk very well yet so it is hard for me to see the errors.
fyi: deleteuser* refers to files in the directory where each one ends with a different date

ls -1 /mfupload/prod02/ftp/deleteuser* | while read line
do
cat $line | awk -F '|' {printf "%s|%\n", $5, $3} >> ftp.dat
done

cat $line

replace it by

echo $line

instead of this ...

cat $line | awk -F '|' {printf "%s|%\n", $5, $3} >> ftp.dat

try this ...

cat $line | awk -F "|" '{printf "%s|%\n", $5, $3}' >> ftp.dat

why? I honestly don't know why echo is correct, please explain.

changing the single quotes to double did not fix the error, sorry

... i think you're missing the single quotes around the curly brackets ... see bold red ...

cat $line | awk -F "|" '{printf "%s|%\n", $5, $3}' >> ftp.dat

sorry, those single quotes didn't do the trick either.

i actually tested your code on one of my files and it does work as i wrote it ... try the cat-awk line on one of your input files from the command line --- if it works there, it should work in the loop too ... if not, maybe your cat-awk line doesn't really correspond to your input file ...

btw, can you post your actual error?

awk: syntax error near line 1
awk: bailing out near line 1
Tue 06/14/05 12:16:57 : Loading Database

please post your actual code as you wrote it too ...

Is this correct, are you sure you done want an 's' after it?

printf "%s|%\n", $5, $3

Anyway the problem you are having is that many versions of awk do not tolerate a space after -F. the command should be

cat $line | awk -F"|" '{printf "%s|%s\n", $5, $3}' >> ftp.dat
or
cat $line | awk -F\| '{printf "%s|%s\n", $5, $3}' >> ftp.dat
or
cat $line | awk -F"|" '{printf "%s|%s\n", $5, $3}' >> ftp.dat

Altough I would probaby just use

awk -F\| '{print $5"|"$3}' $line >> ftp.dat

reborg might be right ... i tested with no spaces after the "-F" as that is how i use the command by default but wrote down the code line as you did it ...

thanks, that did the trick, those nasty spaces! appreciate the help!