How to alter node links
You can load all those nodes by nid with

node_load_multiple(array $nids = NULL, $reset = FALSE);


Loop over all nodes and then find and replace by using

str_replace('original link', 'new link', $node-&gt;field_you_want_to_change);


And then saving the node using

$node-&gt;save()