RE: join two files
"MOKRANI Rachid" <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks Thierry, But I think we don't have the same sed version. My release is (standard CentOS): sed --version GNU sed version 4.2.1 Doesn't work. > -----Message d'origine----- > De : Thierry Blanc [mailto:[email protected]] > Envoyé : mercredi 15 mai 2013 14:23 > À : MOKRANI Rachid > Cc : [email protected] > Objet : Re: join two files > > > sed "$(sed 's|;|s/$/|;s|;| ;/|' file1)" file2 |sed > '/;.*;.*;.*/!s|$| > N/A;|' > > probably it is possible to integrate the last sed statement into the > first ... > > > > On 05/15/2013 01:55 PM, MOKRANI Rachid wrote: > > Hi, > > > > I need some help for doing the following command with sed. > Is someone > > could gibe me the exemple ? > > > > Many thanks. > > > > > > ============================= > > cat /tmp/file_1 > > > > Num;Nbr_pass; > > 5;1; > > 7;1; > > 8;4; > > 12;1; > > 13;5; > > 15;7; > > ============================= > > > > cat /tmp/file2 > > > > Num ; Comments ; > > 1 ; AAAA ; > > 2 ; BBBBB ; > > 3 ; CC ; > > 4 ; XXDF ; > > 5 ; KIJHG ; > > 6 ; GFRD ; > > 7 ; HGTFEDFR ; > > 8 ; DJHY ; > > 9 ; FDGRTFG ; > > 10 ; QWXVG ; > > 11 ; FTGJ ; > > 12 ; DHGRF ; > > 13 ; GFDRFE ; > > 14 ; GFDRFE ; > > 15 ; FGTF ; > > 16 ; LKJU ; > > 17 ; DFDE ; > > > > ============================= > > The result, I would like to have. > > > > > > Num ; Comments ; Nbr_pass ; > > 1 ; AAAA ; N/A ; > > 2 ; BBBBB ; N/A; > > 3 ; CC ; N/A; > > 4 ; XXDF ; N/A; > > 5 ; KIJHG ;1 ; > > 6 ; GFRD ; N/A; > > 7 ; HGTFEDFR ; 1 ; > > 8 ; DJHY ; 1 ; > > 9 ; FDGRTFG ; N/A; > > 10 ; QWXVG ; N/A; > > 11 ; FTGJ ; N/A; > > 12 ; DHGRF ; 1 ; > > 13 ; GFDRFE ; 5 ; > > 14 ; GFDRFE ; N/A; > > 15 ; FGTF ; 7 ; > > 16 ; LKJU ; N/A; > > 17 ; DFDE ; N/A; > > > > > > > > Many thanks for help. > > 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] > > > > > > > > ------------------------------------ > > > > __________________________ 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. __________________________