MOKRANI Rachid rachid.mokrani@ifpen.fr [sed-users]
2016-03-29 07:48:12 UTC
Hi,
Do you have a simple proposal with sed / awk.
In this exemple, need to split column 7
Company A ; NAME A ; FIRSTNAME 1 ; JOB 1 ; Town 1 ; 145854 abVFrd ; COMMENT 1 ;
And obtain 8 columns (7 always a number - 8 always alphabetic)
Company A ; NAME A ; FIRSTNAME 1 ; JOB 1 ; Town 1 ; 145854 ; abVFrd ; COMMENT 1 ;
But sometime the colum 7 can have
; 145854 abVFrd ;
Need to have
; 145854 ; abVFrd;
; 145854;
Need to have
; 145854; ;
; abVFrd;
Need to have
; ; abVFrd;
; ;
Need to have
; ; ;
Company A;NAME A;FIRSTNAME 1;JOB 1;Town 1; 145854 abVFrd;COMMENT 1;
Company A;NAME A;FIRSTNAME 4;JOB 1;Town ;145862 dsfsd; COMMENT 5;
Company B;NAME T ;FIRSTNAME 1;JOB 2;Town 2;ABGHKYH; COMMENT 1235;
Company C;NAME M;FIRSTNAME 2;JOB 7;Town 1;259874; COMMENT 4;
Company Y;NAME G;FIRSTNAME 4;JOB 52;Town 1;; COMMENT 1;
Company Y;NAME F ;FIRSTNAME 8;JOB 82;Town 3;125478; COMMENT 15;
Need to obtain the result below.
Company A;NAME A;FIRSTNAME 1;JOB 1;Town 1; 145854;abVFrd;COMMENT 1;
Company A;NAME A;FIRSTNAME 4;JOB 1;Town ;145862;dsfsd; COMMENT 5;
Company B;NAME T ;FIRSTNAME 1;JOB 2;Town 2;;ABGHKYH; COMMENT 1235;
Company C;NAME M;FIRSTNAME 2;JOB 7;Town 1;259874;; COMMENT 4;
Company Y;NAME G;FIRSTNAME 4;JOB 52;Town 1;;; COMMENT 1;
Company Y;NAME F ;FIRSTNAME 8;JOB 82;Town 3;125478;; COMMENT 15;
Thanks,
Best 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.
__________________________
[Non-text portions of this message have been removed]
Do you have a simple proposal with sed / awk.
In this exemple, need to split column 7
Company A ; NAME A ; FIRSTNAME 1 ; JOB 1 ; Town 1 ; 145854 abVFrd ; COMMENT 1 ;
And obtain 8 columns (7 always a number - 8 always alphabetic)
Company A ; NAME A ; FIRSTNAME 1 ; JOB 1 ; Town 1 ; 145854 ; abVFrd ; COMMENT 1 ;
But sometime the colum 7 can have
; 145854 abVFrd ;
Need to have
; 145854 ; abVFrd;
; 145854;
Need to have
; 145854; ;
; abVFrd;
Need to have
; ; abVFrd;
; ;
Need to have
; ; ;
Company A;NAME A;FIRSTNAME 1;JOB 1;Town 1; 145854 abVFrd;COMMENT 1;
Company A;NAME A;FIRSTNAME 4;JOB 1;Town ;145862 dsfsd; COMMENT 5;
Company B;NAME T ;FIRSTNAME 1;JOB 2;Town 2;ABGHKYH; COMMENT 1235;
Company C;NAME M;FIRSTNAME 2;JOB 7;Town 1;259874; COMMENT 4;
Company Y;NAME G;FIRSTNAME 4;JOB 52;Town 1;; COMMENT 1;
Company Y;NAME F ;FIRSTNAME 8;JOB 82;Town 3;125478; COMMENT 15;
Need to obtain the result below.
Company A;NAME A;FIRSTNAME 1;JOB 1;Town 1; 145854;abVFrd;COMMENT 1;
Company A;NAME A;FIRSTNAME 4;JOB 1;Town ;145862;dsfsd; COMMENT 5;
Company B;NAME T ;FIRSTNAME 1;JOB 2;Town 2;;ABGHKYH; COMMENT 1235;
Company C;NAME M;FIRSTNAME 2;JOB 7;Town 1;259874;; COMMENT 4;
Company Y;NAME G;FIRSTNAME 4;JOB 52;Town 1;;; COMMENT 1;
Company Y;NAME F ;FIRSTNAME 8;JOB 82;Town 3;125478;; COMMENT 15;
Thanks,
Best 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.
__________________________
[Non-text portions of this message have been removed]