On Tue, Aug 25, 2009 at 03:27:51PM -0400, Hall, Leam wrote: > > Bug ID: 1234 > Affected Machines: > somehost1 > somehost2.example.com > somehostwehavenotseeninyears.example.com > > Bug ID: 3456 > Affected Machines: > somehost1 > somehostwehanvenotseeninyears.example.com
All in pseudo code, because I'm not doing your work for you. // Populate the array.. $hosts = array(); foreach (line in file) { // Put code to grab bug numbers up here... // Once you get to the host name lines... $hosts[$name][] = $bug_id; } Now you'll have an array like this: $hosts = array( 1234 => array( 'somehost1', 'somehost2.example.com', 'somehostwehanvenotseeninyears.example.com', ), 3456 => array( 'somehost1', 'somehostwehanvenotseeninyears.example.com', ), ); Finally, you can loop over $hosts and implode, as per someone else's posting upstream in this thread. --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409 _______________________________________________ New York PHP User Group Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk http://www.nyphp.org/show_participation.php