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"
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
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
participants (2)
-
Patrick B. O'Brien
-
Stefan Hundhammer