Help with awk adding spaces.

I have a file that contains...

    
  elm,mail
  elm,lisp,composer,cd,ls,cd,ls,cd,ls,zcat,|,tar,-xvf,ls,cd,ls,cd,ls,vi,ls,cd,ls,vi,elm,-f,ls,rm,ls,cd,ls,vi,vi,ls,vi,ls,cd,ls,elm,cd,ls,cd,ls,vi,vi,vi,ls,vi,ls,i,vi,ls,cp,cd,fg,ls,rm,cd,ls,-l,exit
  elm,mail,biff,elm,biff,elm,elm
  elm,ls
  elm,grep,mail,man,man,-k,fg,look,fg,elm,finger,elm,finger,cd,ls,cd,cd,ls,cd,ls,cd,ls,-l,date,more,ls,-l,more,ls,more,ls,rm,ls,cd,ls,mail,elm,look,fg,fg,cd,cd,ls,cd,ls,cd,ls,cd,ls,vi,man,ls,cd,cd,ls,vi,echo,man,-k,man,ls,cd,ls,biff,ls,elm,fg,exit
  elm,biff,biff,mail,elm,date,rlogin,-l,fg,elm,ls,biff,elm,mesg,finger,finger,talk,logout
  elm,ls,finger,finger,|,more,biff,matlab,clear,elm,rn,ls,matlab,mail,fg,elm,ls,exit
  elm,fk
  matlab
  elm,finger,finger,elm
  cd,ls,cd,ls,ls,-l,sccs,vi,vi,vi,vi,sccs,clear,fg,vi,sccs,ls,ls,-l,vi,vi,vi,vi,clear,sccs,vi,sccs,exit
  elm,mail,exit
  elm,fk,date,mail,exit
  

I want to print out only the lines that have three words. I use....

cat workeditf.txt | awk -F"," '{if (NF = 3) print }' > 1.txt

The answer I get...

  elm mail 
  elm lisp composer
  elm mail biff
  elm ls 
  elm grep mail
  elm biff biff
  elm ls finger
  elm fk 
  matlab  
  elm finger finger
  cd ls cd
  elm mail exit
  elm fk date
  

The answer I should get...

  
  elm mail exit
  

I delete all spaces after each line before I use the awk script. But after the awk script it has blank spaces added on the end of the wrong answers, which I think is causing me to get the wrong answer.

Any suggestions or what other code can I use?

> awk -F"," 'NF==3' workeditf.txt > 1.txt

grep '^[^,]*,[^,]*,[^,]*$' a.txt