From: Riccardo on
I'm using shell script which help me to keep a copy of my mailbox for
last N days (e.g. 40 days), so I need unique total file which will
contain msg about last 40 days.
I'm going to schedule a crontab task which will start every day at the
same time.

How can I create script file, where every time script starts (every
day), I have to replace from total file the part which contains data
about the 40th day with that one which contains latest data ?
Do you know if it exist shell commands to work with SUBTRACTION among
files ?
From: Janis Papanagnou on
Riccardo wrote:
> I'm using shell script which help me to keep a copy of my mailbox for
> last N days (e.g. 40 days), so I need unique total file which will
> contain msg about last 40 days.
> I'm going to schedule a crontab task which will start every day at the
> same time.
>
> How can I create script file, where every time script starts (every
> day), I have to replace from total file the part which contains data
> about the 40th day with that one which contains latest data ?

(I have a faint idea what your question is aiming at but can't decode
your request sufficiently to give an accurate answer. You may want to
provide more information.)

> Do you know if it exist shell commands to work with SUBTRACTION among
> files ?

I assume here you're asking for a command like diff(1) or comm(1); see
the respective man pages for details.

Janis
From: Ed Morton on
On 5/25/2010 1:30 AM, Riccardo wrote:
> I'm using shell script which help me to keep a copy of my mailbox for
> last N days (e.g. 40 days), so I need unique total file which will
> contain msg about last 40 days.
> I'm going to schedule a crontab task which will start every day at the
> same time.
>
> How can I create script file, where every time script starts (every
> day), I have to replace from total file the part which contains data
> about the 40th day with that one which contains latest data ?
> Do you know if it exist shell commands to work with SUBTRACTION among
> files ?

Take a look at procmail, http://www.procmail.org/. In particular
http://lipas.uwasa.fi/~ts/info/proctips.html might be useful.

Ed.