There are a number of ways you can do this automatically, the most simplest would be a semi-manual way. I will give you some pointers, please shout up if you need further explanation.
You say you have 10 families, start by putting these in a new table.
'SELECT family, COUNT(id_article) FROM article GROUP BY family';
This will give you a list
family1, 365
family2, 493
family3, 239
etc etc where the number is the number of articles that belongs to that family. You will need these numbers later as a check.
Create your FAMILY table and manually insert your family details, this can be automated with 'CREATE TABLE family SELECT FROM...' syntax if you feel like reading the documents and being a bit fancy. If you have only 10 families, I personally would just create manually.
Add your extra family_id field to the article table.
Next you need run a query like this.
SELECT id_article, family.id_family FROM article LEFT JOIN family ON (family.family_name = article.family)
loop through this in PHP and echo out a string like this
UPDATE article SET id_family = '.$row['id_family'].' WHERE id_article = '.$row['id_article'].';<br>';
When you run this on your webserver you should get a number of insert statements which you can then save and import into mysql. I prefer to do it this way rather than inserting a number of records through PHP when I have to deal with large updates such as your 4000 records. If you split these into 10 family files, you should see 'xxx rows affected' and it should match your initial figures. If all the figures match, you know your operation was succesful.
You can then drop the family field from the article table.
HTH
Andrew