update category attributes programmatically

If you have many categories and want to update few attributes than you can use code similar to this below. It's fast and saves only values for these attributes which you want to update. You can run this script from browser or from terminal (terminal is better for cases like you described).

<?php

require 'app/Mage.php';
Mage::app();

$resource = Mage::getResourceModel('catalog/category');

// here get category collection

foreach($collection as $category) {
    $category->setStoreId(0);    // 0 for default scope (All Store Views)
    $category->setData('attribute_code', $value);
    $resource->saveAttribute($category, 'attribute_code');
}