The following code should do.... Tweak it to your liking..
UPDATED
<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
// Loading products that satisfies the criteria
$productList = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('*')
// ->addAttributeToFilter('sku', array('like' => '%-T')) //if criteria
;
//Writing to Magento Log
$totalString = count($productList)." Products were found.";
Mage::log($totalString, null, 'listProducts.log');
echo $totalString;
if(count($productList)){
foreach($productList as $product){
//updating products now
try{
$EAN = $product->getAttEan(); // sample EAN, eg $EAN = '1234';
$ID = $product->getEntityId(); // sample ID, eg, $ID = $product->getSku();
$newSku = $EAN . '-' . $ID;//build your new custom sku as per need
$product->setSku($newSku);
//update other if you want
$product->save();
$skuString = "Product with SKU : ".$product->getSku()." updated!!";
Mage::log($skuString, null, 'listProducts.log');
echo $skuString;
}catch(Exception $ex){
Mage::log($ex->getMessage(), null, 'listProducts.log');
echo $ex->getMessage();
}
}
echo "Custom Sku has been updated Succesfully";
}
?>