My scripting talent is sadly failing...
Tom G. Christensen
tgc at statsbiblioteket.dk
Wed Jan 24 14:20:34 CET 2007
Nigel Kendrick wrote:
> Hi Folks,
>
> I have put together the following one-liner to re-submit all emails sent to
> me from an archive folder - it works EXCEPT that the 'echo/cut' command is
> not removing the file extension from the file name and so the emails are not
> processed in the queue. Would someone kindly have a look and educate me!!
>
> grep -l 'To: <nigel.kendrick' * | xargs -t -i bash -c "chmod 700 {} ; cp {}
> /var/spool/postfix/hold/`echo {} | cut -d . -f 1` "
>
I often find that using a simple for loop is much more straightforward
than fiddling with xargs.
Like this:
for i in $(grep -l 'To: <nigel.kendrick' *); do fnam=$(echo $i | cut -d.
-f1); chmod 700 $i; cp $i /var/spool/postfix/hold/$fnam); done
-tgc
More information about the MailScanner
mailing list