[PLUG] Scripting

Rogan Creswick creswick at gmail.com
Wed Apr 13 19:27:38 UTC 2005


On 4/13/05, Michael H. Collins <mike at linuxlink.com> wrote:
> I am doing this by hand and want to put it in a script as I have lots of
> these files to do.
> 
> $ grepmail -hv "\\[SPAM\\]" /data4/mail/correspondance1 > /data2/mail.back/1
> 
> There are 300 correspondance* files all numbered sequentially that need
> to go to /mail.back/* with the same number.

Something like this should do it:
-----begin---
#/usr/bin/perl
$max_num=300;

for($i=0; $i < $max_num; $i++){
     system("grepmail -hv \"\\[SPAM\\]\" /data4/mail/correspondance$i
> /data2/mail.back/$i");
}
----end---
The nested escape characters probably need tweaking, but that's the
general structure in perl.  For testing, replace the call to system
with a call to print, and use the same parameters (but add a \n to the
end of the string to make it easier to read).

As always, test thouroughly before using.

-Rogan
> I tried a few things but I would be embarrassed to show them here.
> 
> Thanks for the help as usual.
> 
> --
> Michael H. Collins  Admiral, Penguinista Navy
> 
> http://linuxlink.com
> 
> /"\     ASCII Ribbon Campaign
> \ /     No HTML/RTF in email
>   x             No Word docs in email
> / \     Respect for open standards
> 
> In a related story, the IRS has recently ruled that
> the cost of Windows upgrades can NOT be deducted
> as a gambling loss.
> 
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>



More information about the PLUG mailing list