In Address Book, as you probably already know, a simple way to find which groups a contact belongs to is to select the contact and hold down the Alt/Option key. The groups will then highlight in the list.
For those who like to have their contacts at least in one group (useful for Mail rules, for example), here's a script to create a new group containing only ungrouped contacts:
property orphan : "Orphans"
tell application "Address Book"
try
if group orphan exists then
repeat with this_person in every person of group orphan
remove this_person from group orphan
end repeat
else
make new group at the end of groups with properties {name:orphan}
end if
save addressbook
repeat with this_person in every person
if number of groups of this_person = 0 then
add this_person to group orphan
end if
end repeat
save addressbook
end try
end tell
[robg adds: I tried this, and it works as expected. And thanks to Doug Adams of Doug's AppleScripts for iTunes, as he helped me figure out why the submitted script wouldn't run as is (a simple missing statement, but I was too blind to see it!).]
Mac OS X Hints
http://hints.macworld.com/article.php?story=20051126084705352