Kill processes

for i in 'ps -f | grep textedit' 
do 
 kill $i 
done 

I wrote this but it wont work.
I am trying to find processes and kill them.

Any help would be welcome.

You can't pass the whole line of the ps command to the kill command, but just the 2nd field:

for i in `ps -f|awk '/textedit/{print $2}'`
do 
  kill $i
done