don't have a code example but iirc you set most of it up through the mass update user interface, including the search for which records to process
the mass update script defines more of a "do this for each result" function
mass update scripts you deploy will show up under custom updates or something like that