You should write a module to do this.
You will need a function that does something like this:
<?php
$type = "publications";
$nodes = node_load_multiple(array(), array('type' => $type));
foreach($nodes as $node){
$node->field_authors[LANGUAGE_NONE][0]['nid'] = $node->field_first_author[LANGUAGE_NONE][0]['nid'];
node_save($node);
}
?>
For a standalone script, you would need to add the following:
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
Then the above code.
You would therefore have a php called updateAuthors.php with the following contents:
<?php
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$type = "publications";
$nodes = node_load_multiple(array(), array('type' => $type));
foreach($nodes as $node){
$node->field_authors[LANGUAGE_NONE][0]['nid'] = $node->field_first_author[LANGUAGE_NONE][0]['nid'];
node_save($node);
}
?>
To add the value in first_author as a new node_reference in field_authors, you need to do something like this:
<?php
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$type = "publications";
$nodes = node_load_multiple(array(), array('type' => $type));
foreach($nodes as $node){
$firstAuthor = $node->field_first_author[LANGUAGE_NONE][0]['nid'];
if ($firstAuthor === false){
continue;
}
$numberOfValuesInFieldAuthors = count($node->field_authors[LANGUAGE_NONE]);
$node->field_authors[LANGUAGE_NONE][$numberOfValuesInFieldAuthors]['nid'] = $firstAuthor
node_save($node);
}
?>
This will skip any nodes that don't have a first author set, and for nodes that do have one set, will add the value in field_first_author as a new node reference in the field_authors field