OK, here's some rewrite subdomain to domain scripts.
subdomain >> domain
RewriteCond %{HTTP_HOST} ^subdomain.example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.subdomain.example.com$
RewriteRule ^(.*)$
http://www.yoursite.com/ [L,R=301]
[redirects subdomain to domain, also fixes www]
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule ^(.*)$
http://www.example.com/directory/$1
[redirects subdomain.example.com >> example.com/directory/ -- but doesn't fix www]
RewriteCond %{HTTP_HOST} ^sub.example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.sub.example.com$ [OR]
RewriteCond %{HTTP_HOST} ^example.(.*)
RewriteRule ^(.*)$
http://www.example.com/directory/$1 [R=301,L]
[as above but fixes www]
You'll have to play around with these, because scripts often have to be changed between servers.