RE: [suse-programming-e] find a word in a file then rm the file
Do you have a recomendation? This box is a mail-relay. It wants to send emails to toulon, toulon rejects it(long story), and I recieve emails about it. I don't like these emails. What to do? tia! -----Original Message----- From: Jerry Feldman [mailto:gaf@blu.org] Sent: Monday, November 15, 2004 5:46 PM To: suse-programming-e@suse.com Subject: Re: [suse-programming-e] find a word in a file then rm the file On Mon, 15 Nov 2004 11:35:54 -0800 "Patrick B. O'Brien" <pobrien@doit.nv.gov> wrote:
Hi,
I need to find a word in a file then remove it. I'm doing the following, but with no luck, thanks.
'find /var/spool/mqueue/ -type f|xargs grep toulon -exec rm {} \;' This is dangerous since you are working with the email queue. An outgong email message usually contains 2 files, the first being the queue file, and starts with qf, the second is the email body and starts with df.
The above command is wrong. find /var/spool/mqueue/ -type f -exec grep toulon {} \; -exec rm {} \; This will look for each file containing the word, toulon, and remove it. However it will only remove the file containing toulon. The queue file may not be removed. As William pointed out you will remove the outgoing email message data file. Make sure you turn off your MTA before doing it. -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9 -- To unsubscribe, email: suse-programming-e-unsubscribe@suse.com For additional commands, email: suse-programming-e-help@suse.com Archives can be found at: http://lists.suse.com/archive/suse-programming-e
On Tuesday 16 November 2004 17:53, Patrick B. O'Brien wrote:
Do you have a recomendation? This box is a mail-relay. It wants to send emails to toulon, toulon rejects it(long story), and I recieve emails about it. I don't like these emails. What to do?
Why not simply use procmail? CU -- Stefan Hundhammer <sh@suse.de> Penguin by conviction. YaST2 Development SUSE Linux Products GmbH Nuernberg, Germany
participants (2)
-
Patrick B. O'Brien
-
Stefan Hundhammer