RE: manipulate column
"MOKRANI Rachid" <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, In the result, it will be the same content as the A.txt file with a new column at the beginning of the line. This new column will take a number in the file B.txt if it exists for the same name. And if the name in file A.txt does not exist in the file B.txt added XXX instead beginning of the line in the result . De : [email protected] [mailto:[email protected]] De la part de Thierry Blanc Envoyé : vendredi 27 septembre 2013 13:25 À : MOKRANI Rachid Cc : [email protected] Objet : Re: manipulate column similar problem that you already asked some month ago. Am I correct that you do not want to have the entries that are only in file 2 $!{ N; s/^/\n/; D } /^([^;]*);.*\n([^;]*);\1/!{ /^[0-9][0-9]*;/b s|^|&XXX;| #/\n/!s/$/ N\/A;/ } /^([^;]*)(;.*)\n([^;]*);\1[^\n]*/{ s||\3;\1\2|; } P; #/^[0-9]/q D; On 27/09/13 14:05, MOKRANI Rachid wrote: Hi, I have two files. (with more than 5000 lines) The first file A.txt, Name_1; Firstname_1; address_A; phone_number; Name_2; Firstname_2; address_B; phone_number; Name_30; Firstname_3; address_C; phone_number; Name_45; Firstname_4; address_D; phone_number; Name_50; Firstname_5; address_E; phone_number; Name_60; Firstname_5; address_E; phone_number; The second file B.txt 0001;Name_1; Firstname_1; address_A; phone_number; 0002;Name_2; Firstname_2; address_B; phone_number; 0003; Name_3;Firstname_3; address_C; phone_number; 1111;Name_4; Firstname_4; address_D; phone_number; 5555;Name_5; Firstname_5; address_E; phone_number; 4567;Name_6; Firstname_6; address_F; phone_number; 1256;Name_7; Firstname_7; address_G; phone_number; 4953;Name_8; Firstname_8; address_H; phone_number; 7896;Name_60; Firstname_5; address_I; phone_number; 7897;Name_61; Firstname_61; address_J; phone_number; I would like to have : 0001;Name_1; Firstname_1; address_A; phone_number; 0002;Name_2; Firstname_2; address_B; phone_number; XXXX;Name_30; Firstname_3; address_C; phone_number; XXXX;Name_45; Firstname_4; address_D; phone_number; XXXX;Name_50; Firstname_5; address_E; phone_number; 7896;Name_60; Firstname_5; address_E; phone_number; Any help would be appreciated. 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. __________________________ __________________________ 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. __________________________