time difference

"MOKRANI Rachid" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
 
Hi,

I have a file like below (with more lines) and I want to compare the elapse time beetwen two date and insert the result in a new colum. 
 
My file :
Num ;        Date_1       ; Status_1 ; 	Date_2		; Status_2
14  ; 2012-10-11 18:09:33 ; CONFIRME ; 2012-10-12 12:33:02 	; REJETEE	
15  ; 2012-10-11 18:09:56 ; CONFIRME ; 2012-10-12 18:24:29 	; REJETEE 	
...
...


I would like to have in the result.

Num ; Elapse_time_in_days ;        Date_1       ; Status_1 ; 	Date_2		; Status_2 
14  ;         0           ; 2012-10-11 18:09:33 ; CONFIRME ; 2012-10-12 12:33:02 	; REJETEE  ;	
15  ;        32           ; 2012-10-11 18:09:56 ; CONFIRME ; 2012-11-12 18:24:29 	; REJETEE  ;	
...
...


I can calculate the différence time like below but I don't know how to insert the result in a new colum with sed may be.

date +%s -d "2012-10-11 18:09:33"
1349971773
date +%s -d "2012-10-12 12:33:02"
1350037982
expr \( 1349971773 - 1350037982 \) / 86400
0


date +%s -d "2012-10-11 18:09:56 "
1349971796
date +%s -d "2012-11-12 18:24:29 "
1352741069
expr \( 1352741069 - 1349971796 \) / 86400
32


Many thanks in advance for any help/idea.
Regards.
__________________________
Avant d'imprimer, pensez à l'environnement ! Please consider the environment before printing ! 
Ce message et toutes ses pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. IFP Energies nouvelles décline toute responsabilité au titre de ce message. This message and any attachments are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. IFP Energies nouvelles should not be liable for this message.
__________________________
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.