Scot Robnett wrote: > I have a delimited file that is formatted like this: > > Altech|[EMAIL PROTECTED]:[EMAIL PROTECTED] Specialties Steel Corp. > |[EMAIL PROTECTED] Specialty Steel Corp. > > > [EMAIL PROTECTED]|[EMAIL PROTECTED]:[EMAIL PROTECTED] > burton.com* > Starwood|[EMAIL PROTECTED] > foods|[EMAIL PROTECTED]:[EMAIL PROTECTED] > starwood|[EMAIL PROTECTED]:[EMAIL PROTECTED] > Authentic Fitness Corp.|[EMAIL PROTECTED] > > > Basically that's one continuous line; there are no line breaks. Don't > ask me, I just inherited the file. The records are delimited by * and > then each individual record is split as company/email by a pipe | > character. If more than one person wants to track a particular > company, their e-mail address is appended to the first with a colon > and split on same for processing.
Here's a simple example that splits each record out, removes an address, and spits the file back out #!/usr/bin/perl use strict; $/='*'; # input lines delimited by '*' while (<>) { chomp; # strip the trailing '*' my ($comp, $addr) = split /\|/; my @addr = split /:/, $addr; # now you can adjust the @addr list to add or remove addresses # for example, remove addresses containing 'mrbill.com' @addr = grep !/mrbill\.com/, @addr; # put everything back together and print it out print join('|', $comp, join(':', @addr)), $/; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]