Re: loop with awk

"Vlad Gershkovich [email protected] [sed-users]" <[email protected]> Fri, 2 Jun 2017 16:10:42 -0400
Newsgroups gmane.editors.sed.user
Message-ID <CAHNe+S+VstxC3CzE3sEWF-d4HuB_=Oo7UkoH=DTBp8B5i_W1Fg@mail.gmail.com>
you can do it all in awk:
awk -F';' '{$(NF+1)=tolower($2 "+" $3)}1' OFS=';' A.txt

On Fri, Jun 2, 2017 at 3:55 PM, Rachid Mokrani [email protected]
[sed-users] <[email protected]> wrote:

>
>
> Hi,
>
> After some search, this is what I need.
>
> cat A.txt
> Mme;Sylvie;Blue;Paris;FR
> Mr;Dan;Green;New-York;USA
> Mr;David;Allen;Cannes;France
>
> #!/bin/bash
> while read -r line
> do
> echo "$line" |awk -F ";" '{print $2"+"$3}' | tr '[:upper:]' '[:lower:]'|awk
> -v i="$line" '{print i";"$1}'
> done < A.txt
>
> result :
>
> Mme;Sylvie;Blue;Paris;FR;sylvie+blue
> Mr;Dan;Green;New-York;USA;dan+green
> Mr;David;Allen;Cannes;France;david+allen
>
> Regards.
>
> 2017-06-02 13:07 GMT+02:00 MOKRANI Rachid [email protected]
> [sed-users] <[email protected]>:
>
> >
> >
> > Hi,
> >
> > Jim's code work perfectly. Thanks.
> >
> > And yes I need to do other requirement (that I don't tell).
> >
> > -----Message d'origine-----
> > De : [email protected] [mailto:[email protected]]
> > Envoyé : vendredi 2 juin 2017 12:46
> > À : [email protected]
> > Objet : Re: loop with awk
> >
> > On Fri, 2 Jun 2017 07:44:36 +0000, "MOKRANI Rachid
> [email protected]
> > [sed-users]" <[email protected]> wrote:
> >
> > > Thanks,
> > >
> > > But I need to add the awk cmd in the loop.
> >
> > No you don't, unless there's some other requirement you didn't tell. Did
> > you try Jim's code? It produces the output you asked for in your first
> > email.
> >
> > --
> > D.
> >
> > ------------------------------------
> > Posted by: Davide Brini <[email protected]>
> > ------------------------------------
> >
> > --
> >
> > ------------------------------------
> >
> > Yahoo Groups Links
> >
> > __________________________
> > 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]
>
> 
>



-- 
*Vlad Gershkovich*
#include <disclaimer.h>


[Non-text portions of this message have been removed]