Re: text substitution in a colum
Thierry Blanc <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
if there are numbers in other columns than the 3rd, use that: sed -r '1!s|(\t[^\t]*\t)([0-9]*)|\1MY_\2|' yourfile it will only change 3rd column. On 26/11/12 20:26, Joel Hammer wrote: > sed "s/\(\t\)\([0-9]\)/\1MY_\2/g" > > This seems to do what you want. > > Joel > > > > On Mon, 2012-11-26 at 15:05 +0100, MOKRANI Rachid wrote: >> >> Hi, >> >> This is my firts port. >> >> I have a file with colum like this. >> >> Title1 Title2 Title3 Title4 >> AA B 66 D >> BB DS 7 TT >> VS FDSE 53 TGF >> BG F 5 GF >> >> I would like to have with a sed command the following result. Add the >> character MY_ before all numbers in the colum number 3 and preserve >> the >> title "Title3". All the colums are seaprate by a tab. >> >> Title1 Title2 Title3 Title4 >> AA B MY_66 D >> BB DS MY_7 TT >> VS FDSE MY_53 TGF >> BG F MY_5 GF >> >> >> >> Many thanks for your help/example. >> >> 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] >> >> >> >> >> > > > > ------------------------------------ >