Thank-you Chuck, Ralf, Phil, Daniel, and Wouter. All your great advice worked, and helped me device a method of attack. What I eventually did was edit the text file itself, with vi, to add "delete from churchmail where email = '" to the start of each line, and to add "';" to the end of each line, then sourced the file of SQL commands.
It took a bit of digging to find out that the beginning of each line is marked by a carot, but then it was a breeze. Thanks to everybody for your time. Robert Wouter van Vliet wrote: > So, you've got a text file with addresses to be deleted? Hmm, that's not too > hard to manage. I suppose that on each line, there is one email address and > only that address? With PHP, i'd do something like: > > <?php > echo "<pre>"; > mysql_connect("host", "user", "pass"); > mysql_select_db("database"); > $textfile = file('directory/otherDirectory/remove.txt'); > $i = 0; > foreach($textfile as $mail) { > $i ++; > $mail = trim($mail); > if (mysql_query("DELETE FROM churchmail WHERE email = '$mail'")) { > echo "[$i] [$mail] deleted\n"; > } else { > echo "[$i] [$mail] ERROR: ".mysql_error()."\n"; > }; > }; > echo "</pre>"; > ?> > > this script should do it, as long as you point to the correct file, you have > PHP installed and the file contains one email address per line, no more than > one and nothing else than that one email address (spaces are removed with > trim()). > > Let us know if you're helped now ! > > Greetz, > Wouter; > > ---------- > Alle door mij verzonden email is careware. Dit houdt in dat het alleen > herlezen en bewaard mag worden als je goed omgaat met al het leven op aarde > en daar buiten. Als je het hier niet mee eens bent dien je mijn mailtje > binnen 24 uur terug te sturen, met opgaaf van reden van onenigheid. > > All email sent by me is careware. This means that it can only be reread and > kept if you are good for all the life here on earth and beyond. If you don't > agree to these terms, you should return this email in no more than 24 hours > stating the reason of disagreement. > > -----Oorspronkelijk bericht----- > Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Verzonden: donderdag 11 juli 2002 03:28 > Aan: [EMAIL PROTECTED] > CC: [EMAIL PROTECTED] > Onderwerp: Re: Mass Delete > > Not surprisingly, I'm still confused. Could you hold my hand? > > Here's what I've got -- > > This is my table -- > > CREATE TABLE churchmail ( > email varchar(30) NOT NULL > ); > > It has one field containing 40,000 email addresses. > > I have a text file -- remove.txt, which contains 1,500 email addresses > which need to be removed from the churchmail table. The database is > named midtn. I think it's the two WHERE clauses that are throwing me. > Whatever it is, I remain stuck, and would appreciate assistance. I'd > like to do this on the command line, no PHP. > > Thanks, > Robert > > Ralf Narozny wrote: > > > Using Linux/Unix I'd say: > > > > echo "SELECT concat('DELETE FROM mailtab WHERE > > mailaddress=',mailaddress,';') FROM mailtab WHERE <some strange > > conditions here>" | mysql <db> | mysql <db> > > > > [EMAIL PROTECTED] wrote: > > > > >I have about 40,000 email addresses in a MySQL database. > > > > > >I also have a list of 1500 email addresses that need to be removed. > > > > > >I am searching for a way to delete these 1500 email addresses en masse, > > >but I have come up short. > > > > > >I sure would appreciate a nudge in the right direction from somebody who > > >might be in the know. > > > > > > > > > > > > > --------------------------------------------------------------------- > > Before posting, please check: > > http://www.mysql.com/manual.php (the manual) > > http://lists.mysql.com/ (the list archive) > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > To unsubscribe, e-mail > <[EMAIL PROTECTED]> > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php